Count amount (1 Viewer)

K1Kingy

Registered User.
Local time
Today, 15:21
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
 

pbaldy

Wino Moderator
Staff member
Local time
Yesterday, 20:21
Joined
Aug 30, 2003
Messages
36,133
Try

SELECT StudentID, Count(StudentID) AS HowMany
FROM TableName
GROUP BY StudentID
 

K1Kingy

Registered User.
Local time
Today, 15:21
Joined
Jun 12, 2008
Messages
20
Thankyou, It works perfectly
 

Users who are viewing this thread

Top Bottom