OneBug This week's bugs
Spot the bug SQL
1
-- Orders still waiting to ship, counted per customer.
2
-- (status is NULL until a packer claims the order)
3
SELECT customer_id, COUNT(*) AS waiting
4
FROM orders
5
WHERE status <> 'shipped'
6
GROUP BY customer_id;

Read the full write-up for this bug (spoilers)