[SQL ] 抓取不同月份數值的交集

作者: docallg968 (嘿嘿嘿)   2022-03-21 06:28:04
資料庫名稱: MySQL/Snowflake
資料庫版本: 2021
內容/問題描述:
各位資深前輩好:
我想要抓取 class 1,2,3,4,5 左下角是2月份,右上角是1月份的資料
示意圖如下:
https://i.imgur.com/zmK0N1t.jpg
請問有沒有辦法從下列code去更改呢?
請各位大大幫忙了,謝謝
====
select
segment,
case when bad_sets.set_uuid is not null then 'bad user set' else 'good use
r set' end as is_disabled,
count(user_set_id) as user_count
from analytics.segmentation
join analytics.user_sets using (user_set_id)
left join dau.bad_sets on user_set_id = set_uuid
where score_date = '2022-02-01'
and first_country_code in ('US', 'CA')
group by 1, 2;
Code跑出來的table如下:
https://i.imgur.com/NgqOPoS.jpg
====

Links booklink

Contact Us: admin [ a t ] ucptt.com