3,492
社区成员
发帖
与我相关
我的任务
分享
select l.类型, avg(l.tt) as 平均历经部门
from (select w.name as 类型,
nvl(o.test5, '0') as tt
from Wechat_content_type w
left outer join
(select content_type,
count(department) as test5
from ordersview
where STATUS_ORDER = '00'
and ILLEGALITEMSTIME >=
to_date('2015-09-01 00:00:00',
'yyyy-MM-dd HH24:mi:ss')
and ILLEGALITEMSTIME <=
to_date('2015-10-31 23:59:59',
'yyyy-MM-dd HH24:mi:ss')
group by orderid, content_type) o
on w.value =o.content_type
order by w.sort
) l
group by l.类型
select w.name as 类型,
nvl(o.test0, '0') as 归档总量,
nvl(o.test1, '0') as 最长历时,
nvl(o.test2, '0') as 最短历时,
nvl(o.test3, '0') as 平均历时
from Wechat_content_type w
left outer join (select content_type,
count(1) as test0,
max(to_date(op_time, 'yyyy-MM-dd HH24:mi:ss') -
illegalitemstime) as test1,
min(to_date(op_time, 'yyyy-MM-dd HH24:mi:ss') -
illegalitemstime) as test2,
avg(to_date(op_time, 'yyyy-MM-dd HH24:mi:ss') -
illegalitemstime) as test3
from ordersview o
where STATUS_ORDER = '00'
and ILLEGALITEMSTIME >=
to_date('2015-09-01 00:00:00',
'yyyy-MM-dd HH24:mi:ss')
and ILLEGALITEMSTIME <=
to_date('2015-10-31 23:59:59',
'yyyy-MM-dd HH24:mi:ss')
group by content_type) o on w.value = o.content_type
order by w.sort