Re: SQL query to display the number of Females and Males
Posté par R&B le 13/9/2005 8:09:37
Hi !
To my mind and with my poor SQL knowledge, it seems to only be possible in two querries.
Sex is only male or female. The number of females is the total minus the males.
First querry wil count total for each department.
Second querry will then count males, differences will give females.
Querry 1 :
SELECT DEPARTMENT AS DEPARTMENT, COUNT(*) AS CNT FROM EMPLOYEE GROUP BY DEPARTMENT
Querry 2 :
SELECT DEPARTMENT AS DEPARTMENT, COUNT(*) AS MALES FROM EMPLOYEE WHERE SEX='male' GROUP BY DEPARTMENT
For the second point, you should find issues in SQL date functions supported by WinDev SQL (not allready in mind but will give it later).
Cette contribution était de : http://old.wdforge.org/newbb/viewtopic.php?forum=5&topic_id=2724&post_id=11455