oracle 统计当年和当月数据

前端之家收集整理的这篇文章主要介绍了oracle 统计当年和当月数据前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
		------年度
		select fa31.AFR042 AFR042,fa31.uus005 uus005,fa31.uus035 uus035,sum(fa31.afa007) afa007
         from fa31 fa31,fa06 fa06
        where fa31.afr041 = fa06.afr104
         and fa06.afr103 = '2'
         and afa080 >=
           TO_DATE(TO_CHAR(sysdate,'YYYY') || '01','YYYY-MM')
         and afa080 <=
           TO_DATE(TO_CHAR(sysdate,'YYYY') || '12','YYYY-MM')
        group by afr042,uus005,uus035
----月度
select fa31.AFR042 AFR042,sum(fa31.afa007) afa007
                  from fa31 fa31,fa06 fa06
                 where fa31.afr041 = fa06.afr104
                   and fa06.afr103 = '2'
              and afa080 = TO_DATE(TO_CHAR(sysdate,'YYYY-MM'),'YYYY-MM'
原文链接:https://www.f2er.com/oracle/210934.html

猜你在找的Oracle相关文章