Click here to Skip to main content
Rate this: bad
good
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 18-Nov-12 23:31pm
Edited 18-Nov-12 23:33pm
v2
Comments
Richard MacCutchan at 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
0 OriginalGriff 254
1 Nirav Prabtani 223
2 Sergey Alexandrovich Kryukov 209
3 _Amy 165
4 Richard MacCutchan 135
0 OriginalGriff 7,799
1 Sergey Alexandrovich Kryukov 6,966
2 Maciej Los 3,994
3 Peter Leow 3,708
4 CHill60 2,742


Advertise | Privacy | Mobile
Web04 | 2.8.140721.1 | Last Updated 19 Nov 2012
Copyright © CodeProject, 1999-2014
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