mysql - Query for finding how many clerks,manager,salesmen are working in a particular department -


i looking query getting total number of jobs department wise. please me on this. below sample of output.

example:

deptno|anlayst|manager|clerk|salesmen 10    |0      |1      |1    |0 20    |2      |1      |2    |0 30    |0      |1      |1    |4 

just sum columns , set group parameter.

for example :

select deptno       ,sum(analyst + manager + clerk + salesmen) employeescount   tablename  group deptno 

working example


Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -