Repeat tickets from the same customer
The task
Support managers count one problem once. A ticket is a repeat when the same customer opened a ticket in the same category less than 14 days before it (14 days is 336 hours; a gap of exactly 14 days is not a repeat). Compare each ticket with the same customer's immediately previous ticket in that category, whether or not that earlier ticket was itself a repeat.
List the repeat tickets. Return ticket_id and customer_id. Sort by ticket_id.
Expected output
ticket_idcustomer_id- Sorted by ticket_id ascending.
- Checked on the sample and on 2 hidden datasets. How grading works
Tables Customer support desk · click a name to insert it
agents14 rows in the sample
Support agents. Key: agent_id.
| int | Unique id. | |
| text | Name. | |
| text | billing, technical or general. | |
| date | Start day. |
tickets900 rows in the sample
One row per ticket. Key: ticket_id.
| int | Unique id. | |
| int | Who opened it. | |
| int | Assigned agent. NULL if never assigned. | |
| text | email, chat or phone. | |
| text | low, normal, high or urgent. | |
| text | billing, bug, how_to or account. | |
| timestamp | Opened (UTC). | |
| timestamp | First reply from an agent. NULL if none yet. | |
| timestamp | Closed as solved. NULL while open. |
satisfaction366 rows in the sample
Survey answers, at most one per ticket. Key: ticket_id.
| int | The ticket. | |
| int | 1 (very unhappy) to 5 (very happy). | |
| timestamp | When answered (UTC). |
Related questions
- Events fired twice within ten secondsmedium
- Current order copy when two copies share a timestamphard
- Customers with several accounts under one emaileasy
- Emails shared by accounts that disagree on countrymedium
- Find exact duplicate rows in a raw order loadeasy
- How many rows would deduplication remove?easy
Loading the editor and PostgreSQL
Loading the editor and PostgreSQL