Advertisement
Guest User

Untitled

a guest
Feb 23rd, 2019
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.34 KB | None | 0 0
  1. personid, msg
  2. --------------
  3. 1, 'msg1'
  4. 2, 'msg2'
  5. 2, 'msg3'
  6. 3, 'msg4'
  7. 1, 'msg2'
  8.  
  9. select distinct personid, count(*)
  10. FROM mytable;
  11.  
  12. select distinct personid, count(msg)
  13. FROM mytable;
  14.  
  15. id, count
  16. --------
  17. 1, 2
  18. 2, 2
  19. 3, 1
  20.  
  21. SELECT personid, COUNT(msg)
  22. FROM mytable
  23. GROUP BY personid
  24. ORDER BY personid;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement