From abfc5c4d2c8618841960d3001609858b513ed045 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=B9=E8=88=9F?= <13007110208@163.com> Date: Thu, 6 Mar 2025 13:46:10 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=962025=E5=B9=B43=E6=9C=886?= =?UTF-8?q?=E6=97=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sql/dwd_before/active_account_df.sql | 2 +- sql/dwd_before/active_df.sql | 21 +++++++++++---------- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/sql/dwd_before/active_account_df.sql b/sql/dwd_before/active_account_df.sql index 5c088f0..8a7e6f9 100644 --- a/sql/dwd_before/active_account_df.sql +++ b/sql/dwd_before/active_account_df.sql @@ -13,7 +13,7 @@ GROUP BY ds ,channel_id ,game_identity ,platform_id -UNION +UNION all SELECT channel_id game_channel_id ,game_identity ,platform_id game_platform_id diff --git a/sql/dwd_before/active_df.sql b/sql/dwd_before/active_df.sql index f2e7417..583185a 100644 --- a/sql/dwd_before/active_df.sql +++ b/sql/dwd_before/active_df.sql @@ -1,16 +1,17 @@ INSERT INTO dwd.active_df(relation_id,user_id,ds,ds_date) -SELECT t2.relation_id - ,t1.user_id - ,t1.ds + +SELECT t1.relation_id + ,t2.user_id + ,t2.ds ,'${biz-date}' ds_date -FROM pubdata_center.ods.active_account_list t1 -INNER JOIN dim.game_product_relation t2 -ON t1.channel_id = t2.game_channel_id +FROM dim.game_product_relation t1 +INNER JOIN pubdata_center.ods.active_account_list t2 +ON t1.game_channel_id = t2.channel_id AND t1.game_identity = t2.game_identity -AND t1.platform_id = t2.game_platform_id +AND t1.game_platform_id = t2.platform_id where ds='${bizdate}' -GROUP BY t2.relation_id - ,t1.user_id - ,t1.ds +GROUP BY t1.relation_id + ,t2.user_id + ,t2.ds ON CONFLICT (relation_id, user_id, ds) DO NOTHING; \ No newline at end of file