Oracle v7.3.3
The following SQL Statement is to count employees per department, per Rep
status. How can I get the count to show if the count is zero '0'?
- BEGIN SQL --
select j.deptid
,decode(substr(j.sal_admin_plan,1,1)
,'R','Rep'
,'Non-Rep') as Rep
,count (j.emplid) as Count
from ps_job j
where j.effdt = (select max(j1.effdt)
from ps_job j1
where j1.emplid = j.emplid
and j1.effdt >= '1-JAN-2001')
and j.effseq = (select max(j1.effseq)
from ps_job j1
where j1.emplid = j.emplid
and j1.effdt = j.effdt)
and j.action <> 'TER'
group by j.deptid, decode(substr(j.sal_admin_plan,1,1)
,'R', 'Rep'
,'Non-Rep')
order by j.deptid, Rep DESC;
- END SQL --
Thanks,
Mark Hamilton
Received on Wed Feb 20 2002 - 13:44:32 CST