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语句统计充值表中今天,昨天,前天三天充值记录的更多相关文章

  1. 一条SQL语句查询两表中两个字段

    首先描述问题,student表中有字段startID,endID.garde表中的ID需要对应student表中的startID或者student表中的endID才能查出grade表中的name字段, ...

  2. Oracle一条SQL语句时快时慢

    今天碰到一个非常奇怪的问题问题,一条SQL语句在PL/SQL developer中很慢,需要9s,问题SQL: SELECT * FROM GG_function_location f WHERE f ...

  3. 使用一条sql语句查询多表的总数

    SELECT sum(列名1) 列名1,sum(列名2) 列名2,sum(列名3) 列名3 FROM ( SELECT count(*) 列名1, 列名2, 列名3 FROM 表1 -- WHERE ...

  4. 用SQL语句将数据表中的数据保存为JSON格式

    没有找到好的工具,只想到了拼字符串的方式,用   NVARCHAR(MAX)  可能有截断,不推荐使用,方法中使用了 FOR XML PATH('') 实现,有关其使用方法参考这里 表结构: SQL ...

  5. 6-03使用SQL语句一次型向表中插入多行数据

    通过将现有表中的数据添加到已存在的表中: INSERT INTO <表名><列名> SELECT<列名> FROM<源表名> 将UserInfo的数据添 ...

  6. 使用SQL语句查询某表中所有的主键、唯一索引以及这些主键、索引所包含的字段(转)

    SELECT 索引名称 = a.name , 表名 = c.name , 索引字段名 = d.name , 索引字段位置 = d.colid FROM sysindexes a JOIN sysind ...

  7. 写出一条Sql语句:取出表A中第31到第40记录(SQLServer,以自动增长的ID作为主键,注意:ID可能不是连续的。

    答:解1:  select top 10 * from A where id not in (select top 30 id from A) 解2:  select top 10 * from A ...

  8. oracle用sql 语句如何向表中插入时间?

    有关日期的操作中,更多的是涉及系统当前时间,用sysdate表示即可,如果是插入其他非系统时间的日期类型数据的话,用to_date转换再插入就可以了.例: insert into 表(c_date) ...

  9. SQL 一条SQL语句 统计 各班总人数,男女各总人数 ,各自 男女 比例 (转)

    select  sClass 班级,count(*)  班级学生总人数, sum(case when sGender=0 then 1 else 0 end) 女生人数, sum(case when ...

随机推荐

  1. hdu4751 Divide Groups

    This year is the 60th anniversary of NJUST, and to make the celebration more colorful, Tom200 is goi ...

  2. HDOJ 4751 Divide Groups

    染色判断二分图+补图 比赛的时候题意居然是反的,看了半天样例都看不懂 .... Divide Groups Time Limit: 2000/1000 MS (Java/Others)    Memo ...

  3. 宿主系统为Ubuntu 14,CentOS 6.5 安装VirtualBox增强工具失败:Building the OpenGL support module[FAILED]

    安装先前的笔记:CentOS 6.3 中安装VirtualBOX增强工具失败:Building the main Guest Additions module[FAILED],执行了以下命令 #安装 ...

  4. JAVA 笔记

    一.Java基础以及面向对象编程1.float类型的数自动转换成double类型时,可能会出现前后不相等的情况,因为有些数不能够用有限的二进制位精确表示.2.右移>>右移,左边空出位以符号 ...

  5. ASN.1编码

    来自几年前本人写的一篇博客 http://blog.csdn.net/newyf_cun/article/details/13016069 如下使用libtasn1分析asn1的编码规则. http: ...

  6. struts2-(1)使用Filter作为控制器

    1.使用filter作为控制器 (1)创建类,实现javax.servlet.Filter package com.controller.filter; import java.io.IOExcept ...

  7. php导入导出cvs文件格式

    1.导入 <?php header("Content-type: text/html; charset=gb2312"); $fname = $_FILES['myfile' ...

  8. activiti查看流程图,有中文乱码

    第一种 因为服务器缺少必要的字体到这的问题: 解决办法 <!-- 发布流程生成图片是正常显示中文 -->            <property name="activi ...

  9. HDU 3743 Frosh Week(归并排序求逆序对)

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=3743 题目意思就是给你一个长为n的序列,让你求逆序对.我用的是归并排序来求的.归并排序有一个合并的过程 ...

  10. BZOJ1452——[JSOI2009]Count

    1.题目大意: 就是给一个n×m的方格,然后一些平面上的 求和 修改操作 2.分析:二维树状数组裸题 #include <cstdio> #include <cstdlib> ...