oracle补齐日期
生成日期列表
SELECT to_date('2017-3-14', 'yyyy-mm-dd') + ROWNUM - as first_login_day,
ROWNUM -
FROM DUAL
CONNECT BY ROWNUM <=
trunc(sysdate - ) -
to_date('2017-3-14', 'yyyy-mm-dd'
范例:生成日期和补全某天充值数据
select t11.fill_day,
t11.first_login_day,
t12.day_fill_total
from (select t13.first_login_day, t14.fill_day
from (SELECT to_date('2017-3-14', 'yyyy-mm-dd') + ROWNUM - as first_login_day,
ROWNUM -
FROM DUAL
CONNECT BY ROWNUM <=
trunc(sysdate - ) -
to_date('2017-3-14', 'yyyy-mm-dd') + ) t13,
(SELECT to_date('2017-3-14', 'yyyy-mm-dd') + ROWNUM - as fill_day,
ROWNUM -
FROM DUAL
CONNECT BY ROWNUM <=
trunc(sysdate - ) -
to_date('2017-3-14', 'yyyy-mm-dd') + ) t14
where t14.fill_day >= t13.first_login_day) t11
left join
(select t5.first_login_day,
t6.fill_day,
sum(t6.day_fill_total) day_fill_total
-- t5.first_login_day, t5.channel, t5.accountid, t6.fill_day, t6.day_fill_total
from t5
right outer join (
-- 每日充值
select trunc(t6.stat_time) as fill_day,
t6.accountid,
sum(t6.paymoney) as day_fill_total
from Fill_TABLE t6
where STAT_TIME >= date'2017-3-14'
group by trunc(t6.stat_time), t6.accountid) t6
on t5.accountid = t6.accountid
group by t5.first_login_day, t6.fill_day) t12
on t11.first_login_day = t12.first_login_day and t11.fill_day = t12.fill_day
oracle补齐日期的更多相关文章
- js获取系统时间时自动补齐日期带零
最近在开发中发现有日期不规范的问题,正常规则应该是yy-mm-dd,而在输出时候却变成yy-mm-d,这是js的date()方法在作怪 解决思路是若在10号前,则自动给它补齐一个0,下面给出解决方法, ...
- JS 日期 自动补齐 “2017-11-22 14:43”
var myDate = new Date(); var myN = myDate.getFullYear(); var myY = myDate.getMonth(); var myR = myDa ...
- oracle Date format日期和月份不补0
格式化日期,日,月只有一位小数的只显示一位,不自动加0,在dd/mm 前面加上fm即可去掉前面的0 如:select to_char(t,'YYYY/fmMM/fmDD') from testdata ...
- java 数字左补齐0
NumberFormat nf = NumberFormat.getInstance(); //设置是否使用分组 nf.setGroupingUsed(false); ...
- Oracle补全日志(Supplemental logging)
Oracle补全日志(Supplemental logging)特性因其作用的不同可分为以下几种:最小(Minimal),支持所有字段(all),支持主键(primary key),支持唯一键(uni ...
- CocoaPods 导入第三方库头文件自动补齐
使用了一段时间CocoaPods来管理Objective-c的类库,方便了不少.但是有一个小问题,当我在xcode输入import关键字的时候,没有自动联想补齐代码的功能,需要手工敲全了文件名,难以适 ...
- 为Debian/Ubuntu的apt-get install添加自动补齐/完成功能
Debian/Ubuntu的apt-get太常用了,不过偶尔可能也会碰到不太熟悉,想不起来的包的名称,除了去debian packages去查找,另外的方法就是给Debian/Ubuntu添加自动补齐 ...
- Delphi中字符串补齐方法
函数功能:当Str不满Len长度时,在Str前自动填充PadStr以补足长度,例子如下: Str:原字符串 Len:补多长 PadStr:用什么补齐,比如‘0’ function PadString( ...
- jquery.autocomplete自动补齐和自定义格式
1.简单的下拉自动补齐,可以使用本地或远程数据源 <input name="autoTag" id="autoTag" /> var source ...
随机推荐
- react-hot-loader 3.0于1.3的区别
现在react-hot-loader 3.0版本应该还是beta版本,不过没关系,还是可以正常使用,我在项目中用的是react-hot-loader 3.0.0-beta.7 版本,并没用发现任何问题 ...
- DES加密Java实现
下面是代码的实现: package com.smt.cipher.symmetry; import java.nio.charset.Charset; import java.security.Sec ...
- py-day1-5 python 分割 、 字母大小转换
# partition() 分割为3段 从左往右遇见的第一个开始 test = 'bassaiwoll' v = test.partition('s') print(v) ('ba', 's', 's ...
- asp.net开发细节整理
1.使用entity framework的DB First时,手动书实体类的表单验证 public partial class Fund { } [MetadataType(typeof(Valida ...
- RedHat如何关闭防火墙
1.查看防火墙是否已开启 #可以查看到iptables服务的当前状态. service iptables status 上图表示防火墙已关闭. 2.关闭防火墙 关闭防火墙的方法为: 1)永久性生 ...
- Keras/Tensorflow训练逻辑研究
Keras是什么,以及相关的基础知识,这里就不做详细介绍,请参考Keras学习站点http://keras-cn.readthedocs.io/en/latest/ Tensorflow作为backe ...
- c# 几种常见的弹框方法
1.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('第一行'); ...
- 手机闪存速度测试工具,AndroBench
手机闪存速度测试工具,AndroBench
- IIS APK MIME
点击新建-填写扩展名和MIME类型 .apk application/vnd.android.package-archive
- nginx 隐藏 index.php
使用情景如下: 在访问 http://php.cc/Att/AttList 的时候.跳转到 http://php.cc/index.php/Att/AttList : 也就是开启重写功能: 在ngin ...