Advertisement
nocturnalmk

Untitled

Aug 5th, 2014
174
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SQL 0.77 KB | None | 0 0
  1.                         SELECT tbl2.total_meetings AS meetings,
  2.                                total_attendants AS attendants,
  3.                                round(total_attendants/tbl2.total_meetings) AS average
  4.                         FROM (
  5.                             (SELECT SUM(tbl1.attendants) AS total_attendants
  6.                              FROM
  7.  
  8.                                 ((SELECT meeting_id AS meeting,
  9.                                        COUNT(member_id) AS attendants
  10.                                  FROM meeting_member
  11.                                  GROUP BY meeting_id) AS details) tbl1 UNION
  12.  
  13.                                 (SELECT COUNT(id) AS total_meetings
  14.                                  FROM meetings) tbl2) tbl3
  15.                         )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement