Write an SQL query to find the second-highest ticket resolution time for each customer support agent, handling ties appropriately.
Return all tickets whose resolution time equals the second distinct-highest value for their agent. Ignore tickets with missing resolution times and agents without a second distinct resolution time.
agent_id, agent_name, ticket_id, and resolution_minutes.agent_id, then ticket_id ascending.| Column | Type | Description |
|---|---|---|
| agent_idPK | INT | Unique identifier for a customer support agent |
| agent_name | VARCHAR(100) | Display name of the support agent |
| Column | Type | Description |
|---|---|---|
| ticket_idPK | INT | Unique identifier for a support ticket |
| agent_id | INT | Agent assigned to the ticket |
| resolution_minutes | INT | Time required to resolve the ticket in minutes |
| ticket_status | VARCHAR(30) | Current ticket status |