报表统计 一年每月数据sql

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/weixin_30512027/article/details/78583840
select year(create_date) 年,
month(create_date) 月,
sum(1) 合计
from casic_xq_js
where create_date BETWEEN '2017-1-1' and '2017-12-31'
group by year(create_date),
month(create_date)
展开阅读全文

报表统计--sql语句

01-09

create or replace view viw_miles_correct_report asrnselectrnf.operation_description operTypeDesc,rnRequestTimes,rnoneCheckTimes,rnround(oneCheckTimes/RequestTimes,4) scale1,rnupTimes,rnround(upTimes/RequestTimes,4) scale2,rntwoCheckTimes,rnround(twoCheckTimes/RequestTimes,4) scale3,rnoneInputTimes,rnround(oneInputTimes/RequestTimes,4) scale4,rntwoInputTimes,rnround(twoInputTimes/RequestTimes,4) scale5rnfromrn(rnselectrnA.OPERATION_TYPE_CODE operTypeCode,rncount(A.RECORD_ID) RequestTimes, rn(select count(b.RECORD_ID) from tbl_operation_manage brn where a.operation_type_code=b.operation_type_codern and b.operation_status_code='A'rn and b.operate_date rn between to_date('2006/01/01','YYYY/mm/dd') and to_date('2008/01/03','YYYY/mm/dd')) oneCheckTimes,rn(select count(c.RECORD_ID) from tbl_operation_manage crn where a.operation_type_code=c.operation_type_codern and c.operation_status_code='U'rn and c.operate_date rn between to_date('2006/01/01','YYYY/mm/dd') and to_date('2008/01/03','YYYY/mm/dd')) upTimes,rn(select count(d.RECORD_ID) from tbl_operation_manage drn where a.operation_type_code=d.operation_type_codern and d.operation_status_code='B'rn and d.operate_date rn between to_date('2006/01/01','YYYY/mm/dd') and to_date('2008/01/03','YYYY/mm/dd')) twoCheckTimes,rn(select count(e.RECORD_ID) from tbl_operation_manage ern where a.operation_type_code=e.operation_type_codern and e.operation_status_code='Y'rn and e.operate_date rn between to_date('2006/01/01','YYYY/mm/dd') and to_date('2008/01/03','YYYY/mm/dd')) oneInputTimes,rn(select count(f.RECORD_ID) from tbl_operation_manage frn where a.operation_type_code=f.operation_type_codern and f.operation_status_code='F'rn and f.operate_date rn between to_date('2006/01/01','YYYY/mm/dd') and to_date('2008/01/03','YYYY/mm/dd')) twoInputTimesrnfrom tbl_operation_manage Arnwhere a.operation_type_code='MILESCORRECT'rnand a.operate_date between to_date('2006/01/01','YYYY/mm/dd') and to_date('2008/01/03','YYYY/mm/dd')rngroup by A.OPERATION_TYPE_CODErn) e,rntbl_operation_type frn where e.operTypeCode=f.operation_codernrn我现在的视图用到GROUP BY,不能按时间来查,有什么方法可以解决吗? 论坛

没有更多推荐了,返回首页