merge into ml_song_summary_info as target
                using
                (
                    SELECT
                    COALESCE(clip_id, 'UNKNOWN') AS song_id,
                    SUM(CASE WHEN play_duration_threshold = 0 AND platform = 'web' THEN play_cnt ELSE 0 END) AS web_total_play_cnt_0,
                    SUM(CASE WHEN play_duration_threshold = 0 AND platform = 'web' THEN play_duration_sec ELSE 0 END) AS web_total_play_duration_0,
                    SUM(CASE WHEN play_duration_threshold = 0 AND platform = 'android' THEN play_cnt ELSE 0 END) AS android_total_play_cnt_0,
                    SUM(CASE WHEN play_duration_threshold = 0 AND platform = 'android' THEN play_duration_sec ELSE 0 END) AS android_total_play_duration_0,
                    SUM(CASE WHEN play_duration_threshold = 0 AND platform in ('ios', 'ipados') THEN play_cnt ELSE 0 END) AS ios_total_play_cnt_0,
                    SUM(CASE WHEN play_duration_threshold = 0 AND platform in ('ios', 'ipados') THEN play_duration_sec ELSE 0 END) AS ios_total_play_duration_0,
                    SUM(CASE WHEN play_duration_threshold = 5 AND platform = 'web' THEN play_cnt ELSE 0 END) AS web_total_play_cnt_5,
                    SUM(CASE WHEN play_duration_threshold = 5 AND platform = 'web' THEN play_duration_sec ELSE 0 END) AS web_total_play_duration_5,
                    SUM(CASE WHEN play_duration_threshold = 5 AND platform = 'android' THEN play_cnt ELSE 0 END) AS android_total_play_cnt_5,
                    SUM(CASE WHEN play_duration_threshold = 5 AND platform = 'android' THEN play_duration_sec ELSE 0 END) AS android_total_play_duration_5,
                    SUM(CASE WHEN play_duration_threshold = 5 AND platform in ('ios', 'ipados') THEN play_cnt ELSE 0 END) AS ios_total_play_cnt_5,
                    SUM(CASE WHEN play_duration_threshold = 5 AND platform in ('ios', 'ipados') THEN play_duration_sec ELSE 0 END) AS ios_total_play_duration_5,
                    SUM(CASE WHEN play_duration_threshold = 0 THEN play_cnt ELSE 0 END) AS sum_total_play_cnt_0,
                    SUM(CASE WHEN play_duration_threshold = 0 THEN play_duration_sec ELSE 0 END) AS sum_total_play_duration_0,
                    SUM(CASE WHEN play_duration_threshold = 5 THEN play_cnt ELSE 0 END) AS sum_total_play_cnt_5,
                    SUM(CASE WHEN play_duration_threshold = 5 THEN play_duration_sec ELSE 0 END) AS sum_total_play_duration_5,
                    SUM(CASE WHEN play_duration_threshold = 0 AND is_user_song_owner != true AND platform = 'web' THEN play_duration_sec ELSE 0 END) AS web_non_creator_listen_duration_0,
                    SUM(CASE WHEN play_duration_threshold = 5 AND is_user_song_owner != true AND platform = 'web' THEN play_duration_sec ELSE 0 END) AS web_non_creator_listen_duration_5,
                    SUM(CASE WHEN play_duration_threshold = 0 AND is_user_song_owner != true AND platform = 'android' THEN play_duration_sec ELSE 0 END) AS android_non_creator_listen_duration_0,
                    SUM(CASE WHEN play_duration_threshold = 5 AND is_user_song_owner != true AND platform = 'android' THEN play_duration_sec ELSE 0 END) AS android_non_creator_listen_duration_5,
                    SUM(CASE WHEN play_duration_threshold = 0 AND is_user_song_owner != true AND platform in ('ios', 'ipados') THEN play_duration_sec ELSE 0 END) AS ios_non_creator_listen_duration_0,
                    SUM(CASE WHEN play_duration_threshold = 5 AND is_user_song_owner != true AND platform in ('ios', 'ipados') THEN play_duration_sec ELSE 0 END) AS ios_non_creator_listen_duration_5,
                    SUM(CASE WHEN is_user_song_owner != true AND play_duration_threshold = 0 THEN play_duration_sec ELSE 0 END) AS sum_non_creator_listen_duration_0,
                    SUM(CASE WHEN is_user_song_owner != true AND play_duration_threshold = 5 THEN play_duration_sec ELSE 0 END) AS sum_non_creator_listen_duration_5
                FROM agg_play_info_hourly_v0
                GROUP BY clip_id
                ) as source
                ON (target.song_id = source.song_id)
                WHEN MATCHED THEN
                    UPDATE SET
                    target.web_total_play_cnt_0 = source.web_total_play_cnt_0,
                    target.web_total_play_duration_0 = source.web_total_play_duration_0,
                    target.android_total_play_cnt_0 = source.android_total_play_cnt_0,
                    target.android_total_play_duration_0 = source.android_total_play_duration_0,
                    target.ios_total_play_cnt_0 = source.ios_total_play_cnt_0,
                    target.ios_total_play_duration_0 = source.ios_total_play_duration_0,
                    target.web_total_play_cnt_5 = source.web_total_play_cnt_5,
                    target.web_total_play_duration_5 = source.web_total_play_duration_5,
                    target.android_total_play_cnt_5 = source.android_total_play_cnt_5,
                    target.android_total_play_duration_5 = source.android_total_play_duration_5,
                    target.ios_total_play_cnt_5 = source.ios_total_play_cnt_5,
                    target.ios_total_play_duration_5 = source.ios_total_play_duration_5,
                    target.sum_total_play_cnt_0 = source.sum_total_play_cnt_0,
                    target.sum_total_play_duration_0 = source.sum_total_play_duration_0,
                    target.sum_total_play_cnt_5 = source.sum_total_play_cnt_5,
                    target.sum_total_play_duration_5 = source.sum_total_play_duration_5,
                    target.web_non_creator_listen_duration_0 = source.web_non_creator_listen_duration_0,
                    target.web_non_creator_listen_duration_5 = source.web_non_creator_listen_duration_5,
                    target.android_non_creator_listen_duration_0 = source.android_non_creator_listen_duration_0,
                    target.android_non_creator_listen_duration_5 = source.android_non_creator_listen_duration_5,
                    target.ios_non_creator_listen_duration_0 = source.ios_non_creator_listen_duration_0,
                    target.ios_non_creator_listen_duration_5 = source.ios_non_creator_listen_duration_5,
                    target.sum_non_creator_listen_duration_0 = source.sum_non_creator_listen_duration_0,
                    target.sum_non_creator_listen_duration_5 = source.sum_non_creator_listen_duration_5
