SQL: Select latest thread and latest post, grouped by forum, ordered by latest post
问题 I'm trying to get the latest thread (id, topic, timestamp, author_id) and latest post (id, thread_id, timestamp, author_id) of each forum (id, name) ordered by the latest post , indepent from the thread's creationdate. Why? I'd like to be able to display details like: "The latest Answer of forum $forum_id was given on Question $thread_id. Here it is: $post_id" SELECT f.id AS forum_id, f.name AS forum_name, t.id AS thread_id, t.topic AS thread_topic, t.ts AS thread_timestamp, p.id AS post_id,