Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SELECT `threads`.`id`, `threads`.`name`, COALESCE(`posts`.`date`, `threads`.`date`) AS `date`
- FROM `threads`
- LEFT JOIN (
- SELECT `posts`.`tothread`, `posts`.`date`
- FROM `posts`
- ORDER BY `date` DESC
- ) AS `posts`
- ON `posts`.`tothread` = `threads`.`id`
- GROUP BY `name`
- ORDER BY `date` DESC
Advertisement
Add Comment
Please, Sign In to add comment