Click here to Skip to main content
15,896,557 members
Articles / Database Development / SQL Server

Ask about a query in sql server

Rate me:
Please Sign up or sign in to vote.
0.00/5 (No votes)
18 Nov 2012CPOL 1.8K  
Hello guys. I have a question about a query in AdventureWorksi use HumanResources.Employee and these following fieldsemployeeid, birthdate i want to know howmany employees burnt in every year

Alternatives

Members may post updates or alternatives to this current article in order to show different approaches or add new features.

Please Sign up or sign in to vote.
18 Nov 2012StianSandberg
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 Count1945 11946 31947 11948 11949 11950 101951 1.....

License

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


Written By
Iran (Islamic Republic of) Iran (Islamic Republic of)
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions