The title is pathetic, I don't really know how to word the issue better than this, let me explain.
I've got a Tests
table and TestAttendance
table where I create a record each time user takes a test with user id and test id.
What I want to do is: While listing the tests I want to show total number of attendants for each test.
(
SELECT COUNT(ta.id)
FROM TestUserAttendances ta
JOIN Tests t ON ta.testId = t.id
)
The above query returning the total number of attendants without distinguishing test, so the total number of attendants added to each test while I want it to display each test individually.