Sea*_*een 2 sql oracle plsql case count
select yearreported
, theleadcraft
, count(NotStage3)
, count(NotStage2)
, count(NotStage1)
from
(
select extract(year from reportdate) as YearReported
, Nvl(leadcraft, 'NONE') as TheLeadCraft
, CASE when status not in ('CAN', 'CLOSE') then 1 else 0 END as NotStage3
, CASE when status not in ('CAN', 'CLOSE', 'COMP') then 1 else 0 END as NotStage2
, CASE when status not in ('CAN', 'CLOSE', 'COMP', 'WORKDONE') then 1 else 0 END as NotStage1
from workorder
) query
group by yearreported, theleadcraft;
;
Run Code Online (Sandbox Code Playgroud)
在此先感谢您的帮助!
归档时间: |
|
查看次数: |
17564 次 |
最近记录: |