A pivot via conditional aggregation gives wrong (doubled) numbers. The query is below. What is the most likely cause of the inflated values?
SELECT p.product_id,
SUM(CASE WHEN s.region = 'East' THEN s.amount END) AS east,
SUM(CASE WHEN s.region = 'West' THEN s.amount END) AS west
FROM products p
JOIN sales s ON s.product_id = p.product_id
JOIN shipments sh ON sh.product_id = p.product_id
GROUP BY p.product_id;