31 lines
992 B
SQL
31 lines
992 B
SQL
-- 根据游戏汇总活跃账号数据 天日增
|
|
INSERT INTO dwd.active_account_df(game_channel_id,game_identity,game_platform_id,active_num,ds,ds_type,ds_name)
|
|
SELECT channel_id game_channel_id
|
|
,game_identity
|
|
,platform_id game_platform_id
|
|
,count(distinct user_id) active_num
|
|
,ds ds
|
|
,'d' ds_type
|
|
,'天' ds_name
|
|
FROM ods.active_account_list
|
|
WHERE ds = '${bizdate}'
|
|
GROUP BY ds
|
|
,channel_id
|
|
,game_identity
|
|
,platform_id
|
|
UNION all
|
|
SELECT channel_id game_channel_id
|
|
,game_identity
|
|
,platform_id game_platform_id
|
|
,count(distinct user_id) active_num
|
|
,'${t_month}' AS ds
|
|
,'m' ds_type
|
|
,'月' ds_name
|
|
FROM ods.active_account_list
|
|
WHERE ds >= '${t_month}'
|
|
AND ds <= '${bizdate}'
|
|
GROUP BY channel_id
|
|
,game_identity
|
|
,platform_id
|
|
ON CONFLICT (game_channel_id,game_identity,game_platform_id,ds,ds_type) DO UPDATE SET active_num = EXCLUDED.active_num
|
|
; |