Advertisement
nocturnalmk

Untitled

Jul 25th, 2014
229
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SQL 0.68 KB | None | 0 0
  1. mysql> SELECT SUM(attendants) AS total_attendants FROM (SELECT meeting_id AS meeting, COUNT(member_id) AS attendants FROM meeting_member GROUP BY (meeting_id)) AS details;
  2. +------------------+
  3. | total_attendants |
  4. +------------------+
  5. |                3 |
  6. +------------------+
  7. 1 ROW IN SET (0.00 sec)
  8.  
  9. mysql> SELECT COUNT(id) AS total_meetings FROM meetings;
  10. +----------------+
  11. | total_meetings |
  12. +----------------+
  13. |              3 |
  14. +----------------+
  15. 1 ROW IN SET (0.00 sec)
  16.  
  17.  
  18. =====
  19.  
  20. +------------------+----------------+
  21. | total_attendants | total_meetings |
  22. +------------------+----------------+
  23. |                3 |              3 |
  24. +------------------+----------------+
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement