oracle 查询优化
来源:学生作业帮 编辑:大师作文网作业帮 分类:英语作业 时间:2024/09/22 17:24:50
oracle 查询优化
select count(*),sum(bal) from rpt_xd where substr(beg_date,5,2)= substr('20130131',5,2) and substr(beg_date,1,4)=substr('20130131',1,4) and term_mon3 and term_mon6 and term_mon12
各位能帮我把它变成一句话吗 只有后面的term_mon条件不同而已 主要就是查询每段term_mon的count(*)和sum(bal)
select count(*),sum(bal) from rpt_xd where substr(beg_date,5,2)= substr('20130131',5,2) and substr(beg_date,1,4)=substr('20130131',1,4) and term_mon3 and term_mon6 and term_mon12
各位能帮我把它变成一句话吗 只有后面的term_mon条件不同而已 主要就是查询每段term_mon的count(*)和sum(bal)
晕死,你那个20130131都知道是查2013年1月份的了,你就直接='201301'就好了,substr用多了会造成查询速度缓慢的竖着显示就union all就好了,像楼上那位说的那样,横着显示这样select sum(case when term_mon<3 then 1 else 0 end) 小于3数量,
sum(case when term_mon<3 then bal else 0 end) 小于3值,
sum(case when term_mon>3 and term_mon<6 then 1 else 0 end) 大于3小于6数量,
sum(case when term_mon>3 and term_mon<6 then bal else 0 end) 大于3小于6值,
sum(case when term_mon>6 and term_mon<12 then 1 else 0 end) 大于6小于12数量,
sum(case when term_mon>6 and term_mon<12 then bal else 0 end) 大于6小于12值,
sum(case when term_mon>12 then 1 else 0 end) 大于12数量,
sum(case when term_mon>12 then bal else 0 end) 大于12值
from rpt_xd where substr(beg_date,1,6)= '201301'
sum(case when term_mon<3 then bal else 0 end) 小于3值,
sum(case when term_mon>3 and term_mon<6 then 1 else 0 end) 大于3小于6数量,
sum(case when term_mon>3 and term_mon<6 then bal else 0 end) 大于3小于6值,
sum(case when term_mon>6 and term_mon<12 then 1 else 0 end) 大于6小于12数量,
sum(case when term_mon>6 and term_mon<12 then bal else 0 end) 大于6小于12值,
sum(case when term_mon>12 then 1 else 0 end) 大于12数量,
sum(case when term_mon>12 then bal else 0 end) 大于12值
from rpt_xd where substr(beg_date,1,6)= '201301'
oracle 语句 查询优化
oracle 查询优化
oracle 语句优化问题
oracle语句查询 or和and
浅析ORACLE数据库的优化方案如何翻译
Oracle查询数据怎么按照甲乙丙丁排序?
用oracle的话,查询语句该怎么写?
oracle 子查询:select *,(select account from t_ps_member m where
一条平常用的查询语句 怎么优化.
oracle 查询 保存两位小数 比如数据 0.01 ;0 显示结果为 0.01 ;0.00
Oracle数据库中如何查询一个用户A下面所有的表的信息
oracle 查询出的数据,把不足十位的数字前面补充0