You are given support ticket data from athenahealth practices using athenaOne. Write a PostgreSQL query that returns the most common customer issues for each practice, ranked by ticket volume. Only include tickets created in January 2024 with a status other than closed. If two issue types have the same ticket count within a practice, they should receive the same rank. Return the practice name, issue category, ticket count, and rank, ordered by practice and rank.
| Column | Type | Description |
|---|---|---|
| practice_idPK | INT | Unique identifier for a medical practice |
| practice_name | VARCHAR(100) | Display name of the practice |
| region | VARCHAR(50) | Geographic region for the practice |
| Column | Type | Description |
|---|---|---|
| category_idPK | INT | Unique identifier for an issue category |
| category_name | VARCHAR(100) | Issue category label |
| severity | VARCHAR(20) | Default severity associated with the issue category |
| Column | Type | Description |
|---|---|---|
| ticket_idPK | INT | Unique support ticket identifier |
| practice_id | INT | Practice that submitted the ticket |
| category_id | INT | Issue category associated with the ticket |
| created_at | DATE | Date the ticket was created |
| status | VARCHAR(20) | Current workflow status of the ticket |