Gruppera efter advert_id
och använd en villkorlig aggregering
select advert_id,
sum(type = 'click') as clicks,
sum(type = 'view') as views
from your_table
group by advert_id
Gruppera efter advert_id
och använd en villkorlig aggregering
select advert_id,
sum(type = 'click') as clicks,
sum(type = 'view') as views
from your_table
group by advert_id