Order Status Counts per Customer
For each customer return the number of delivered orders and the number of cancelled orders as two columns. Order by customer_id.
Table schema
Orders(id INT PRIMARY KEY, customer_id INT, status VARCHAR(20))Sample data
id | customer_id | status
1 | 1 | Delivered
2 | 1 | Cancelled
3 | 1 | Delivered
4 | 2 | Cancelled
Discussion
No discussions yet.
Shalyam Support
Hi! Ask us anything — we'll reply on WhatsApp or Telegram within 24 hours.