This commit is contained in:
wuaho 2021-07-21 15:32:49 +08:00
parent 3173404d9a
commit 60b285b21e
4 changed files with 54 additions and 5 deletions

View File

@ -1,6 +1,13 @@
drop table if exists zhengba.recharge_game;
create view zhengba.recharge_game as
select toDate(addHours(`#event_time`, 8)) as date, `#bundle_id`, owner_name, channel, sum(money) as money
select toDate(addHours(`#event_time`, `#zone_offset`)) as date,
`#os`,
`#bundle_id`,
owner_name,
channel,
arrayDistinct(groupArray(binduid)) as account,
length(account) as account_num,
sum(money) as money
from zhengba.event
where `#event_name` = 'rechargeGame'
group by toDate(addHours(`#event_time`, 8)), toDate(addHours(`#event_time`, 8)), `#bundle_id`, owner_name, channel
order by date
group by toDate(addHours(`#event_time`, `#zone_offset`)), `#os`, `#bundle_id`, owner_name, channel

View File

@ -1,4 +1,12 @@
create view zhengba.new_account as select toDate(addHours(`#event_time`,8)) as date, groupArray(`binduid`) as account,length(account) as num
drop table if exists zhengba.new_account;
create view zhengba.new_account as
select toDate(addHours(`#event_time`, `#zone_offset`)) as date,
`#os`,
`#bundle_id`,
owner_name,
channel,
groupArray(`binduid`) as account,
length(account) as num
from zhengba.event
where role_idx = 1
group by toDate(addHours(`#event_time`,8))
group by toDate(addHours(`#event_time`, `#zone_offset`)), `#os`, `#bundle_id`, owner_name, channel

23
新账号付费.sql Normal file
View File

@ -0,0 +1,23 @@
drop table if exists zhengba.new_account_recharge;
create view zhengba.new_account_recharge as (select date,
`#os`,
`#bundle_id`,
owner_name,
channel,
uniqExact(binduid) as accout_num,
sum(money) as money
from (select toDate(addHours(`#event_time`, `#zone_offset`)) as date,
`#os`,
`#bundle_id`,
owner_name,
channel,
binduid,
money
from zhengba.event
where `#event_name` = 'rechargeGame') as tb1
left join (select toDate(addHours(`#event_time`, `#zone_offset`)) as date,
binduid
from zhengba.event
where role_idx = 1) as tb2
on tb1.date = tb2.date and tb2.binduid = tb1.binduid
group by date, `#os`, `#bundle_id`, owner_name, channel)

11
活跃账号视图.sql Normal file
View File

@ -0,0 +1,11 @@
drop table if exists zhengba.active_account;
create view zhengba.active_account as
select toDate(addHours(`#event_time`, `#zone_offset`)) as date,
`#os`,
`#bundle_id`,
owner_name,
channel,
uniqCombined(binduid) as num,
arrayDistinct(groupArray(binduid)) as account
from zhengba.event
group by toDate(addHours(`#event_time`, `#zone_offset`)), `#os`, `#bundle_id`, owner_name, channel