Hi All,
I am trying to build a query that will print the group name and total number of users in each group.
[code=php]Group | counter
Sport 14
Guest 7
Friends 0
employee 0
Family 3
[/code]
I used this query, but the mysql will not print the group name if there is no data on students table 🙁
SELECT groups.id, groups.title, count(students.id) as total
FROM groups, students
WHERE groups.id = students.gid
GROUP BY students.gid
and the result will be
Group | counter
----------------------------------------
Sport 14
Guest 7
Family 3
Thanks in advance