Easy SQL question

From: Mark Hamilton <user_at_user.net>
Date: Wed, 20 Feb 2002 10:44:32 -0900
Message-ID: <u77v53ckc8i316_at_corp.supernews.com>


Oracle v7.3.3
[Quoted] 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 - 20:44:32 CET

Original text of this message