Day Grab stool Data sql

Source: Internet
Author: User

--Find the schedule first
SELECT * from Hv_item_info a where a.report_begdate > ' 2016-07-28 ' and A.report_begdate < ' 2016-07-29 ';

--Search for rounds
SELECT * from Media_item_wheel_info a WHERE a.item_id = 46088 and a.rule_id = 0215 ORDER by a.begin_date;

--Key conditions
SELECT * from Media_user_dial_info a WHERE a.item_id = 46088 and a.item_wheel_id in (' 74419 ');

--Number of winners
SELECT * from Media_prizerl_info a WHERE a.item_id = 46088 and a.item_wheel_id in (' 74419 ');

--Pre-start online number
Select * FROM (
Select T.callingnbr,
T.callednbr,
T.flag,
Leads (T.flag, 1, null) over ( Partition by T.CALLINGNBR, T.CALLEDNBR Order by T.logdate) Nextflag,
T.logdate,
Leads (t.logdate, 1, null) over (part Ition 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 n Extflag is null;

--The number of people online at the end
SELECT * FROM (
Select T.callingnbr,
T.CALLEDNBR,
T.flag,
Leads (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;

Day Grab stool Data sql

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.