Advertisement
nocturnalmk

Untitled

Aug 5th, 2014
205
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SQL 0.72 KB | None | 0 0
  1.                         SELECT total_meetings AS meetings,
  2.                                total_attendants AS attendants,
  3.                                round(total_attendants/total_meetings) AS average
  4.                         FROM (
  5.                             (SELECT SUM(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,
  12.  
  13.                                 (SELECT COUNT(id) AS total_meetings
  14.                                  FROM meetings) tbl2
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement