抢凳子日数据sql
--先找到档期
select * from hv_item_info a where a.report_begdate > '2016-07-28' and a.report_begdate < '2016-07-29';
--找轮次
select * from media_item_wheel_info a where a.item_id = 46088 and a.rule_id = 0215 order by a.begin_date;
--按键情况
select * from media_user_dial_info a where a.item_id = 46088 and a.item_wheel_id in ('74419');
--中奖人数
select * from media_prizerl_info a where a.item_id = 46088 and a.item_wheel_id in ('74419');
--开始前在线人数
select * from (
select t.callingnbr,
t.callednbr,
t.flag,
lead(t.flag, 1, null) over(partition by t.callingnbr, t.callednbr order by t.logdate) nextflag,
t.logdate,
lead(t.logdate, 1, null) over(partition by t.callingnbr, t.callednbr order by t.logdate)
from MEDIA_USER_ONLINE_OFFLINE_LOG t
where t.callednbr in ('12590484666', '12590484667')
and t.flag <> 'DD'
and t.logdate >= to_Date('20160728105000', 'yyyymmddhh24miss')
and t.logdate <= to_Date('20160728113739', 'yyyymmddhh24miss')) a
where a.flag = 'on' and nextflag is null;
--结束时的在线人数
select * from (
select t.callingnbr,
t.callednbr,
t.flag,
lead(t.flag, 1, null) over(partition by t.callingnbr, t.callednbr order by t.logdate) nextflag,
t.logdate,
lead(t.logdate, 1, null) over(partition by t.callingnbr, t.callednbr order by t.logdate)
from MEDIA_USER_ONLINE_OFFLINE_LOG t
where t.callednbr in ('12590484666', '12590484667')
and t.flag <> 'DD'
and t.logdate >= to_Date('20160728105000', 'yyyymmddhh24miss')
and t.logdate <= to_Date('20160728113749', 'yyyymmddhh24miss')) a
where a.flag = 'on' and nextflag is null;
最新文章
- .NET平台开源项目速览(18)C#平台JSON实体类生成器JSON C# Class Generator
- Android JNI总结
- PHP unset()函数销毁变量 但没有实现释放内存
- *HDU1053 哈夫曼编码
- AFNetworking之缓存篇
- WPF自动隐藏的消息框(鼠标放上去将一直显示,移开动画继续),提供normal和error两种边框。
- Windows Server 2012 Recycle Bin corrupted
- Struts2 实战(一)
- AndEngine
- 黑马程序员——经典C语言程序设计100例
- 第四篇、微信小程序-icon组件
- merge into sql优化
- C#微信开发之旅--自定义菜单
- Mac Zip命令
- Zabbix的LLD功能--Low-level discovery
- C# 还原SQL数据库(非存储过程方式)
- intent传对象
- Delphi用ADOquery主从表例子(转)
- [Python]获取子线程异常信息
- 爬虫抓包工具Charles设置
热门文章
- WIN7 OEM Nin1 地址
- 最短路模板(Dijkstra &; Dijkstra算法+堆优化 &; bellman_ford &; 单源最短路SPFA)
- 使用delphi+intraweb进行微信开发3—微信消息处理
- ./upload/source/class/class_core.php
- 在VS中添加lib的简单方法
- spring+ibatis整合
- js代码生成form,解决mvc的url参数过长问题
- 自增长主键Id的另类设计
- php 判断文件或目录是否存在
- WebViewJavascriptBridge详细使用(转载)