Saturday, August 16, 2008

Count on Case

Break on Report
Compute Sum Of Salesman Clerk Manager Analyst Total On Report
Select Mgr,
Count(Case When JOB = 'SALESMAN' Then 1 End) As SALESMAN ,
Count(Case When JOB = 'CLERK' Then 1 End) As CLERK ,
Count(Case When JOB = 'MANAGER' Then 1 End) As MANAGER ,
Count(Case When JOB = 'ANALYST' Then 1 End) As ANALYST ,
Count( 1 ) As Total
From Emp
Where Job <> 'PRESIDENT'
Group By Mgr;

No comments:

Post a Comment