Count amount

K1Kingy

Registered User.
Local time
Today, 14:46
Joined
Jun 12, 2008
Messages
20
I am running a query to see how many students have books overdue. The query runs fine and i can produce good reports out of it.

What i am wanting to do is count the amount of overdue books students have.

So in the query i am selecting StudentID book and days overdue.

StudentID | Book | DaysOverdue
1 | Hello World | 12
1 | Test Book | 3
3 | Computers | 10

so how can i count studentIDs to figure out how many books are overdue.

StudentID 1 has 2 books
StudentID 3 has 1 book
 
Try

SELECT StudentID, Count(StudentID) AS HowMany
FROM TableName
GROUP BY StudentID
 
Thankyou, It works perfectly
 

Users who are viewing this thread

Back
Top Bottom