将BIRT和Maximo中已完成的工作与未完成的工作分开

时间:2020-01-30 02:41:48

标签: birt maximo

所以我首先使用如下语句:

select count(wonum)as workorder,gsasaddresscode,status from maximo.workorder where  istask=0 and
month(reportdate)=12 and year(reportdate)=2019 and worktype != 'PM' and status != 'CAN'
group by status,gsasaddresscode

问题是,我们有14个状态(状态?),这些状态基本上最终是完整的或不完整的,而这正是我想要显示的。

Building  |Incomplete Work Orders | Complete Work Orders
AB002341  |       200             |        634

1 个答案:

答案 0 :(得分:0)

这是Oracle:

 select sum(Complete), sum(Open) ,location from (
  select wo.status, wo.location,
 case when wo.status in (select SD.VALUE from synonymdomain sd where sd.domainid = 'WOSTATUS' and value ='CLOSE' or value = 'CAN'or value = 'COMP') then 1 else 0 end Complete,
 case when wo.status in (select SD.VALUE from synonymdomain sd where sd.domainid = 'WOSTATUS' and value ='APPR' or value = 'INPRG'or value = 'WAPPR') then 1 else 0 end Open
 from maximo.workorder wo  where  istask=0 and
 TO_CHAR (reportdate,'MM')= '12' and  TO_CHAR (reportdate,'YYYY') ='2019' and worktype != 'PM')
 group by location