17,377
社区成员
发帖
与我相关
我的任务
分享
select t.cust_mana_id,
sum(case when t.cust_mana_id is not null and t.cmplted_date is null then 1 else 0 end) as "在途定单",
sum(case when t.cust_mana_id is not null and t.is_assembly_ord = 1 then 1 else 0 end) as "待装定单",
sum(case when t.cust_mana_id is not null and (to_date(t.must_date, 'yyyy/mm/dd hh24:mi:ss')-t.cmplted_date) < 0 then 1 else 0 end) as "全程超时",
sum(case when t.cust_mana_id is not null and (to_date(t.limit_dt, 'yyyy/mm/dd hh24:mi:ss')-t.fnsh_dt) < 0 then 1 else 0 end) as "环节超时",
sum(case when t.cust_mana_id is not null and (to_date(t.must_date, 'yyyy/mm/dd hh24:mi:ss')-t.cmplted_date) < 7 then 1 else 0 end) as "超7工作日",
sum(case when t.cust_mana_id is not null and t.cmplted_date is not nullthen 1 else 0 end) as "已完成定单"
from iom_list_table t
group by t.cust_mana_id
大概就这样把