An SQL Querry

Puiu

Well-known member
Joined
Oct 6, 2004
Messages
90
I have a table Users with the fields :

username varchar(50),
Birthdate Datetime


I want to select the month in which most users are born
 
Id think youd want something like

SELECT COUNT(username) AS num_of_users, MONTH(Birthdate)
GROUP BY MONTH(Birthdate)
ORDER BY num_of_users
 
more like
Code:
SELECT TOP 1 MONTH(Birthdate) FROM Users
GROUP BY MONTH(Birthdate)
ORDER BY COUNT(username) DESC
 
Back
Top