Message de rapport:
 

Re: SQL query to display the number of Females and Males

Sujet: Re: SQL query to display the number of Females and Males
par R&B sur 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).
Connexion
Menu
Chercher WDForge
Chercher Web
Partenaires
Visualiser tous les Partenaires...
WinDev, WebDev, WinDev Mobile et HyperFile sont des marques déposées par PCSoft. |  Voter |  Legal |  Contact |   XOOPS 2.0.13.2