java web 的orcale中sql优化

天_下_无_双 发布于 2016/01/13 09:49
阅读 117
收藏 0
select h.a,f.c,f.b,g.d from
(select count(distinct t.card_id) a from pf_record_card_statistics t where
trunc(sysdate) = trunc(t.operation_date)) h,
(select count(tt.card_id) b,tt.credit_behavior c from pf_record_card_statistics tt where
trunc(sysdate) = trunc(tt.operation_date) group by tt.credit_behavior order by tt.credit_behavior) f,
(select count(distinct ttt.card_id) d,ttt.credit_behavior e from pf_record_card_statistics ttt where
trunc(sysdate) = trunc(ttt.operation_date)  group by ttt.credit_behavior order by ttt.credit_behavior) g where f.c = g.e;
谁能更好的优化一下?欢迎各位的技术指导
加载中
0
妹子楼顶有鸽子
妹子楼顶有鸽子
1、(select count(tt.card_id) b,tt.credit_behavior c from pf_record_card_statistics tt where
trunc(sysdate) = trunc(tt.operation_date) group by tt.credit_behavior order by tt.credit_behavior) f 和(select count(distinct ttt.card_id) d,ttt.credit_behavior e from pf_record_card_statistics ttt where
trunc(sysdate) = trunc(ttt.operation_date)  group by ttt.credit_behavior order by ttt.credit_behavior) g 合并去掉排序:(SELECT COUNT(tt.card_id) AS b,COUNT(DISTINCT ttt.card_id) AS d, tt.credit_behavior AS c
FROM pf_record_card_statistics tt
WHERE trunc(sysdate) = trunc(tt.operation_date)
GROUP BY tt.credit_behavior
) f
2、
h和f直接笛卡尔??
返回顶部
顶部