Skip to main content
Admissions guidance, study banks, and career tools — get started on Shalyam

Monthly Order Status Pivot

Return one row per month with the number of 'paid' orders and the number of 'refunded' orders as separate columns, ordered by month.

Table schema

Orders(id INT PRIMARY KEY, order_date DATE, status VARCHAR(10))

Sample data

id | order_date | status
1 | 2026-01-03 | paid
2 | 2026-01-10 | refunded
3 | 2026-01-20 | paid
4 | 2026-02-02 | paid
5 | 2026-02-15 | paid
6 | 2026-02-20 | refunded

Discussion

No discussions yet.

Rewards · v2.1

Get Exclusive Insights with Every Issue

Join Shalyam Newsletter

Stay ahead in education, research, and innovation—straight to your inbox.