Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SELECT
- product_name,
- SUM(CASE
- WHEN store_location = 'North' THEN num_sales ELSE 0 END
- ) AS north,
- SUM(CASE
- WHEN store_location = 'Central' THEN num_sales ELSE 0 END
- ) AS central,
- SUM(CASE
- WHEN store_location = 'South' THEN num_sales ELSE 0 END
- ) AS south,
- SUM(CASE
- WHEN store_location = 'West' THEN num_sales ELSE 0 END
- ) AS west
- FROM product_sales
- GROUP BY product_name
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement