Click here to Skip to main content
12,622,652 members (28,475 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: SQL-Server
Hello guys. I have a question about a query in AdventureWorks

i use HumanResources.Employee and these following fields
employeeid, birthdate
i want to know howmany employees burnt in every year
Posted 19-Nov-12 0:31am
Updated 19-Nov-12 0:33am
v2
Comments
Richard MacCutchan 19-Nov-12 5:33am
   
burnt?

1 solution

Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

I guess you ment born every year.
Count and Group by YEAR:

SELECT YEAR(BirthDate) As [Year], COUNT(*) as [Count]
FROM [HumanResources].[Employee]
GROUP BY YEAR(BirthDate)

Result:
Year	Count
1945	1
1946	3
1947	1
1948	1
1949	1
1950	10
1951	1
.....
  Permalink  
v4

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.161128.1 | Last Updated 19 Nov 2012
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100