Posted by Shiva, June 6, 2023, 8:14 a.m.
Q100. Alternate solution explanation
Hi Leon,
For the Q100, I used this solution but 2/5 result rows have the wrong ROI value, can you explain what is wrong in this query ?
SELECT advertiser_id,COALESCE(SUM(spend),0)/ SUM(cost) as roi
FROM ad_info ad
RIGHT JOIN advertiser adv
ON ad.ad_id = adv.ad_id
GROUP BY 1