-
GROUP BY Clause
Hi All,
I have a SQL statement which gives me groupings of my employees in their age group. I have a DOB column in my table and this is what I want my output to be like .......
AgeGroup EmployeeCount
--------- -------------
0 - 10 yrs 0
11 - 20 yrs 2
21 - 30 yrs 29
31 - 40 yrs 21
41 - 50 yrs 15
51 - 60 yrs 9
61 - 70 yrs 3
> 70 yrs 0
But here is what I am getting .......
AgeGroup EmployeeCount
--------- -------------
11 - 20 yrs 2
21 - 30 yrs 29
31 - 40 yrs 21
41 - 50 yrs 15
51 - 60 yrs 9
61 - 70 yrs 3
I have two rows missing, 0-10 yrs and > 70 yrs age groups. This is happening since I don't have any employees falling into those categories. How do I force my query to display zeros for these categories. Any amount of help will be grately appreciated.
Thanks !
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|