well right now I have:
[PHP]$sql = "SELECT tl_topic.topic_ id, tl_topic.title, tl_topic.user_i d FROM tl_team_topic, tl_topic WHERE tl_team_topic.t eam_id = '$team_id' AND tl_team_topic.t opic_id = tl_topic.topic_ id ORDER BY tl_topic.topic_ id DESC"[/PHP]
and this gets all the topics in the right order if none had comments. but I want to sort by topic_id and the latest comment on each topic. If there are no comments...
User Profile
Collapse
-
Let me just be clear what I am asking for, I am just looking for the mySQL SELECT statement which would give me all the topics in the correct order.
I was trying to do it with temperary tables and joins but I think there might be an easier way
The first topic would be the newest one added or the one with the latest comment
Thanks Again...Leave a comment:
-
Complex query question
For some reason I can't figure out the following. I am using mysql and php.
I have the following 2 tables
tl_topic //a topic
topic_id //id of the topic
title //the title of the topic
comment //the body of the topic
user_id //the user who posted the topic
tl_topic_commen t //comments on a topic
topic_id
...
No activity results to display
Show More
Leave a comment: