diff --git a/充值视图.sql b/充值视图.sql index 02803bc..f32f0f6 100644 --- a/充值视图.sql +++ b/充值视图.sql @@ -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 \ No newline at end of file +group by toDate(addHours(`#event_time`, `#zone_offset`)), `#os`, `#bundle_id`, owner_name, channel \ No newline at end of file diff --git a/新用户视图.sql b/新用户视图.sql index 7064672..1359076 100644 --- a/新用户视图.sql +++ b/新用户视图.sql @@ -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)) \ No newline at end of file +group by toDate(addHours(`#event_time`, `#zone_offset`)), `#os`, `#bundle_id`, owner_name, channel \ No newline at end of file diff --git a/新账号付费.sql b/新账号付费.sql new file mode 100644 index 0000000..7bf7a80 --- /dev/null +++ b/新账号付费.sql @@ -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) \ No newline at end of file diff --git a/活跃账号视图.sql b/活跃账号视图.sql new file mode 100644 index 0000000..260bd88 --- /dev/null +++ b/活跃账号视图.sql @@ -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 \ No newline at end of file