Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 (my)SQL question

Author  Topic 

Labordus
Starting Member

3 Posts

Posted - 2001-08-15 : 16:19:39
This is what I have:
SELECT ROUND((TO_DAYS(NOW())-TO_DAYS(birthdate))/365) as age, if(gender = 'M', COUNT(*), 0) as male, if (gender = 'F', COUNT(*), 0) as female
FROM users
GROUP BY age, gender

This is the result:
age, male, female
20 , 12 , 0
21 , 0 , 3
24 , 8 , 0
24 , 0 , 6
What I want is that the last two results are shown together, I mean like this:
24, 8, 6

DOes anyone know how to do this?



   

- Advertisement -