首页 > 数据库技术 > 详细

oracle一条sql语句统计充值表中今天,昨天,前天三天充值记录

时间:2014-11-24 16:48:32      阅读:423      评论:0      收藏:0      [点我收藏+]
select NVL(sum(case when create_date_time>=to_date(‘2014-11-24 00:00:00‘,‘yyyy-mm-dd hh24:mi:ss‘) 
and create_date_time<=to_date(‘2014-11-24 23:59:59‘,‘yyyy-mm-dd hh24:mi:ss‘) then amount end),0) today
,NVL(sum(case when create_date_time>=to_date(‘2014-11-23 00:00:00‘,‘yyyy-mm-dd hh24:mi:ss‘) 
and create_date_time<=to_date(‘2014-11-23 23:59:59‘,‘yyyy-mm-dd hh24:mi:ss‘) then amount end),0) yesterday
,NVL(sum(case when create_date_time>=to_date(‘2014-11-22 00:00:00‘,‘yyyy-mm-dd hh24:mi:ss‘)
and create_date_time<=to_date(‘2014-11-22 23:59:59‘,‘yyyy-mm-dd hh24:mi:ss‘) then amount end),0) TheDayBeforeYesterday
from t_pay;

 假设今天是 2014-11-24

 

oracle一条sql语句统计充值表中今天,昨天,前天三天充值记录

原文:http://www.cnblogs.com/Nbge/p/4118819.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!