First-response SLA by channel

mediumSQL~25 min · 4 tests · helpdesk

Each priority has a first-response target in slas.first_response_hours. The support lead wants to know which channel (email, web, chat) meets it most often.

A ticket’s first response is the earliest ticket_events row for that ticket with event_type = 'first_response'. A ticket met the SLA if that first response happened no later than opened_at + first_response_hours. Exactly on the deadline counts as met.

A ticket with no first-response event did not meet the SLA, but it still counts in tickets.

Return one row per channel:

column type meaning
channel text the channel the ticket came in on
tickets integer all tickets on that channel
met_sla integer tickets that met their first-response target
met_pct decimal met_sla / tickets * 100, rounded to 1 decimal

Row order doesn’t matter.

Tables: tickets, ticket_events, slas.

solution.sqlDuckDB · helpdesk

Press ⌘ ↵ or Run to check the visible tests. Submit runs the hidden ones too. Everything runs in your browser.

⌘ ↵ to run