Seskupit podle advert_id
a použijte podmíněnou agregaci
select advert_id,
sum(type = 'click') as clicks,
sum(type = 'view') as views
from your_table
group by advert_id
Seskupit podle advert_id
a použijte podmíněnou agregaci
select advert_id,
sum(type = 'click') as clicks,
sum(type = 'view') as views
from your_table
group by advert_id