Jun 4, 2005 #1 P 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
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
Jun 4, 2005 #2 HJB417 Well-known member Joined Mar 5, 2003 Messages 609 Location Lowell, MA Id think youd want something like SELECT COUNT(username) AS num_of_users, MONTH(Birthdate) GROUP BY MONTH(Birthdate) ORDER BY num_of_users
Id think youd want something like SELECT COUNT(username) AS num_of_users, MONTH(Birthdate) GROUP BY MONTH(Birthdate) ORDER BY num_of_users
Jun 4, 2005 #3 PROKA Well-known member Joined Sep 3, 2003 Messages 249 Location Bucharest more like Code: SELECT TOP 1 MONTH(Birthdate) FROM Users GROUP BY MONTH(Birthdate) ORDER BY COUNT(username) DESC
more like Code: SELECT TOP 1 MONTH(Birthdate) FROM Users GROUP BY MONTH(Birthdate) ORDER BY COUNT(username) DESC