On Wed, 2006-08-02 at 11:13 -0600, John Meyer wrote: > I have two tables: > > > MEMBERS: > MEM_ID > ... > > GROUPS: > GRO_ID: > ... > > And one joiner > > MEM_GRO: > MEM_ID, GRO_ID > > > I want to print out a list like this > > GROUP_NAME, NUMBER_OF_MEMBERS > > Even when the number of members is 0, how do I do that?
SELECT G.NAME AS GROUP_NAME , COUNT(*) AS NUMBER_OF_MEMBERS FROM GROUPS G LEFT JOIN MEM_GRO AS M ON G.GRO_ID = M.GRO_ID GROUP BY G.GRO_ID; By the way, when you use ALLCAPS for everything, it makes it very difficult to pick out SQL keywords, and MAKES IT SEEM LIKE YOU ARE SHOUTING. -jay -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]