select bureau_name deptName,
sum(decode(bill_type,'A',1,0)) billInstallCount, --字段bill_type的值为A 或B
sum(decode(bill_type,'B',1,0)) billRetractCount,
sum(finish_time - accept_time ) timeCount, --字段finish_time,accept_time为date型
sum(decode(sign( finish_time - accept_time -1),1,1,0)) timeOutCount,
sum(decode(bill_tache,'B',1,0)) billCount_B, --字段bill_tache的值为A、B或C
sum(decode(bill_tache,'A',1,0)) billCount_A,
sum(decode(bill_seq,'B',1,0)) bill_seq_B --字段bill_seq的值为A 或B
from installphonebillmain a ,installareabureaumap b
where a.bureau_id=b.bureau_code
group by a.bureau_id,bureau_name----------
select count(*) from installphonebillmain ---表installphonebillmain共46961条数据我执行上面的SQL语句共耗时113秒左右。
请问如何优化??这么写为什么如此耗时?
谢谢!!!
sum(decode(bill_type,'A',1,0)) billInstallCount, --字段bill_type的值为A 或B
sum(decode(bill_type,'B',1,0)) billRetractCount,
sum(finish_time - accept_time ) timeCount, --字段finish_time,accept_time为date型
sum(decode(sign( finish_time - accept_time -1),1,1,0)) timeOutCount,
sum(decode(bill_tache,'B',1,0)) billCount_B, --字段bill_tache的值为A、B或C
sum(decode(bill_tache,'A',1,0)) billCount_A,
sum(decode(bill_seq,'B',1,0)) bill_seq_B --字段bill_seq的值为A 或B
from installphonebillmain a ,installareabureaumap b
where a.bureau_id=b.bureau_code
group by a.bureau_id,bureau_name----------
select count(*) from installphonebillmain ---表installphonebillmain共46961条数据我执行上面的SQL语句共耗时113秒左右。
请问如何优化??这么写为什么如此耗时?
谢谢!!!
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货