advert_id
でグループ化 条件付き集計を使用します
select advert_id,
sum(type = 'click') as clicks,
sum(type = 'view') as views
from your_table
group by advert_id
advert_id
でグループ化 条件付き集計を使用します
select advert_id,
sum(type = 'click') as clicks,
sum(type = 'view') as views
from your_table
group by advert_id