Hi,
Hoping someone can help with what should be a simple problem.
Have two tables:
Classes and Enroll
Classes contains some classes with a ClassID, Enroll has a ClassID and a MemberID.
When a member enrolls in a class a entry is made in the enroll table with their member ID and the class ID.
I want to be able to retrieve a list of classes with the number of people enrolled to the class, am using the following:
SELECT Class.Name, COUNT (*) AS EnrollCount
FROM Class left JOIN Enroll ON Enroll.ClassID = Class.ClassID
GROUP BY Class.Name
This is working except that classes with no members enrolled are still showing as one (I assume because the COUNT is counting the entry from the left join). If I use a inner join it simply does not show the classes with no members joined. I need a display of classes with number of members including those with no members.
Please help!