zoukankan      html  css  js  c++  java
  • oracle一条sql语句统计充值表中今天,昨天,前天三天充值记录

    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

  • 相关阅读:
    bzoj 1054
    bzoj 1047
    bzoj 2761
    bzoj 1191
    bzoj 2748
    bzoj_1003 物流运输
    新的开始( [USACO08OCT]打井Watering Hole)
    map
    Generic Cow Protests-G——60分做法
    逆序对
  • 原文地址:https://www.cnblogs.com/Nbge/p/4118819.html
Copyright © 2011-2022 走看看