Write a SQL query using complex joins and aggregations to count active incident records across multiple tables based on specific regional criteria.
Use incidents created during January 2026, where active status means triggered or acknowledged. Include only the regional codes us-east, eu-west, and ap-southeast, and require the assigned team to be active.
region_code, region_name, and active_incident_countregion_code ascending| Column | Type | Description |
|---|---|---|
| region_idPK | INT | Unique region identifier |
| region_code | VARCHAR(30) | PagerDuty region code |
| region_name | VARCHAR(100) | Human-readable region name |
| Column | Type | Description |
|---|---|---|
| team_idPK | INT | Unique response team identifier |
| team_name | VARCHAR(100) | Response team name |
| region_id | INT | Region assigned to the team |
| is_active | BOOLEAN | Whether the team currently handles incidents |
| Column | Type | Description |
|---|---|---|
| service_idPK | INT | Unique PagerDuty service identifier |
| service_name | VARCHAR(120) | PagerDuty service name |
| owning_team_id | INT | Team that owns the service |
| Column | Type | Description |
|---|---|---|
| incident_idPK | INT | Unique incident identifier |
| service_id | INT | Service associated with the incident |
| assigned_team_id | INT | Team currently assigned to the incident |
| status | VARCHAR(30) | Incident lifecycle status |
| created_at | TIMESTAMP | Incident creation timestamp |
| priority | VARCHAR(10) | Incident priority |