Advertisement
Guest User

Untitled

a guest
Sep 24th, 2017
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. select post_id, count(post_id) from comments group by post_id order by count(post_id) desc limit 5;
  2. post_id | count
  3. ---------+-------
  4. 5 | 5
  5. 6 | 4
  6. 3 | 3
  7. 7 | 2
  8. 1 | 2
  9. (5 rows)
  10.  
  11.  
  12. select id,title from posts where id will be [5,6,3,7,1] with this order
  13.  
  14. id | title
  15. ----+------------------------------------------------------------------
  16. 5 | Samsung 3G Chromebook Review
  17. 6 | The dd command on Linux terminal.
  18. 3 | Debian Mozilla team creates a Release archive for Iceweasel
  19. 7 | Seven Months of Bodhi Linux in Pictures
  20. 1 | New story! Cloud and On-premise Face Same Hacker Threats
  21. (5 rows)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement