17,086
社区成员
发帖
与我相关
我的任务
分享
<sql-query name="getGameKeepRateStats">
select cre_day datetime,
nvl(yx_rs, 0) gameNum,
nvl(yx_lc_rs_1, 0) morroDayNum ,
nvl(yx_lc_rs_3, 0) threeDayNum,
nvl(yx_lc_rs_7, 0) sevenDayNum
from (select cre_day,
count(account) yx_rs,
count(case
when exists
(select 'x'
from acm_order_lottery tmp
where tmp.account = t1.account
and tmp.create_time >=
to_date(t1.cre_day, 'yyyymmdd') - 1
and tmp.create_time <
to_date(t1.cre_day, 'yyyymmdd')
and not exists
(select 'x'
from acm_order_lottery tmp2
where tmp.account = tmp2.account
and tmp2.create_time <
to_date(t1.cre_day, 'yyyymmdd') - 1)
and not exists
(select 'x'
from acm_order_lottery_his tmp3
where tmp.account = tmp3.account
and tmp3.create_time <
to_date(t1.cre_day, 'yyyymmdd') - 1)) then
account
end) yx_lc_rs_1,
count(case
when exists
(select 'x'
from acm_order_lottery tmp
where tmp.account = t1.account
and tmp.create_time >=
to_date(t1.cre_day, 'yyyymmdd') - 2
and tmp.create_time <
to_date(t1.cre_day, 'yyyymmdd') - 1
and not exists
(select 'x'
from acm_order_lottery tmp2
where tmp.account = tmp2.account
and tmp2.create_time <
to_date(t1.cre_day, 'yyyymmdd') - 2)
and not exists
(select 'x'
from acm_order_lottery_his tmp3
where tmp.account = tmp3.account
and tmp3.create_time <
to_date(t1.cre_day, 'yyyymmdd') - 2)) then
account
end) yx_lc_rs_3,
count(case
when exists
(select 'x'
from acm_order_lottery tmp
where tmp.account = t1.account
and tmp.create_time >=
to_date(t1.cre_day, 'yyyymmdd') - 6
and tmp.create_time <
to_date(t1.cre_day, 'yyyymmdd') - 5
and not exists
(select 'x'
from acm_order_lottery tmp2
where tmp.account = tmp2.account
and tmp2.create_time <
to_date(t1.cre_day, 'yyyymmdd') - 6)
and not exists
(select 'x'
from acm_order_lottery_his tmp3
where tmp.account = tmp3.account
and tmp3.create_time <
to_date(t1.cre_day, 'yyyymmdd') - 6)) then
account
end) yx_lc_rs_7
from (select to_char(create_time, 'yyyymmdd') cre_day, account
from acm_order_lottery aot
where create_time >= :startDate
and create_time < :endDate
and status in (1, 2, 3, 4, 5, 7)
and error_code = '000000'
group by to_char(create_time, 'yyyymmdd'), account) t1
group by cre_day)
order by cre_day