Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # 14. Posts and Commentators
- SELECT
- p.id,
- p.caption,
- COUNT(DISTINCT c.user_id) AS `users`
- FROM posts As p
- LEFT JOIN comments AS c
- ON p.id = c.post_id
- GROUP BY p.id
- ORDER BY `users` DESC, p.id;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement