Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SELECT forum_thread.*, p1.username AS user, COUNT(test2.id) AS replies, p2.username AS reply, max(test2.id) as lastid
- FROM forum_thread
- LEFT JOIN people AS p1 ON forum_thread.uid = p1.id
- LEFT JOIN (Select * from
- forum_comment
- ORDER BY id DESC) as test2
- ON forum_thread.id = test2.ftid
- LEFT JOIN people AS p2 ON test2.uid = p2.id
- Where forum_thread.fcid = $id
- GROUP BY forum_thread.id
- ORDER BY forum_thread.type DESC, test2.post_time DESC, test2.id DESC, forum_thread.id
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement