Open Tickets by Priority
Return the number of tickets still open (closed_at IS NULL) per priority, ordered by priority.
Table schema
Tickets(id INT PRIMARY KEY, customer VARCHAR(10), agent VARCHAR(10), priority VARCHAR(6), opened_at DATETIME, closed_at DATETIME)Sample data
id | customer | agent | priority | opened_at | closed_at
1 | Ann | Raj | high | 2026-08-01 09:00:00 | 2026-08-01 11:00:00
2 | Bob | Raj | low | 2026-08-01 10:00:00 | 2026-08-02 10:00:00
3 | Cy | Mia | high | 2026-08-02 08:00:00 | 2026-08-02 09:30:00
4 | Ann | Mia | low | 2026-08-03 12:00:00 | NULL
5 | Dee | Raj | high | 2026-08-03 13:00:00 | NULL
Discussion
No discussions yet.
Shalyam Support
Hi! Ask us anything — we'll reply on WhatsApp or Telegram within 24 hours.