JeroenDortmans
Technical User
I have the following tables:
TABLE FORUMS
forum_id
forum_name
forum_description
active
TABLE TOPICS
topic_id
forum_id
topic_title
topic_user_id
topic_views
topic_replies
topic_last_post
topic_text
topic_image_name
topic_replayto
TABLE USERS
user_id
username
user_password
user_posts
user_email
user_website
user_country
user_city
Now I have the following query:
SELECT DISTINCT forums.forum_id, forums.forum_name, forums.forum_description, topics.topic_id, topics.topic_user_id, topics.topic_last_post, flaneren_users.username
FROM forums, topics, flaneren_users
WHERE topics.topic_user_id = flaneren_users.user_id AND forums.forum_id = topics.forum_id AND forums.active = 1
GROUP BY forums.forum_id
ORDER BY topics.topic_last_post DESC
The problem with this query is that it doesn't returns the last posting (topics.topic_last_post).
When I make a query with MAX(topics.topic_last_post) it returns the last posting, but the topics.topic_user_id isn't corresponding with the last date returned by MAX(topics.topic_last_post).
How can I make this query work correct?????
TABLE FORUMS
forum_id
forum_name
forum_description
active
TABLE TOPICS
topic_id
forum_id
topic_title
topic_user_id
topic_views
topic_replies
topic_last_post
topic_text
topic_image_name
topic_replayto
TABLE USERS
user_id
username
user_password
user_posts
user_email
user_website
user_country
user_city
Now I have the following query:
SELECT DISTINCT forums.forum_id, forums.forum_name, forums.forum_description, topics.topic_id, topics.topic_user_id, topics.topic_last_post, flaneren_users.username
FROM forums, topics, flaneren_users
WHERE topics.topic_user_id = flaneren_users.user_id AND forums.forum_id = topics.forum_id AND forums.active = 1
GROUP BY forums.forum_id
ORDER BY topics.topic_last_post DESC
The problem with this query is that it doesn't returns the last posting (topics.topic_last_post).
When I make a query with MAX(topics.topic_last_post) it returns the last posting, but the topics.topic_user_id isn't corresponding with the last date returned by MAX(topics.topic_last_post).
How can I make this query work correct?????