Reputation: 63
I have a table like this.
Name ID BirthDate
Bob 1 01/09/2010
jojo 2 02/09/2012
Where PK is joint of Name and ID, I want to count in each day (1,2,...),how many people share the same day(just day, ignoring month and year). I know I have to use day() function. I try:
Select count(Name & ID)
from Table
group by day(BirthDate);
Upvotes: 1
Views: 58
Reputation: 311308
count(*)
counts rows - it should fit your bill:
SELECT DAY(BirthDate), COUNT(*)
FROM MyTable
GROUP BY DAY(BirthDate)
Upvotes: 1