A facilities team wants to identify locations with the highest recent maintenance costs. Write a SQL query to calculate recent maintenance spend, work-order volume, and average resolution time for each facility.
Use September 15, 2026 as the reporting date and consider work orders opened during the preceding 90 days.
facility_id, facility_name, total_maintenance_spend, work_order_count, and avg_resolution_hours.facility_id ascending as the tie-breaker.| Column | Type | Description |
|---|---|---|
| facility_idPK | INT | Unique facility identifier |
| facility_name | VARCHAR(150) | Facility name |
| Column | Type | Description |
|---|---|---|
| work_order_idPK | INT | Unique work order identifier |
| facility_id | INT | Facility where maintenance occurred |
| maintenance_cost | NUMERIC(12,2) | Maintenance spend for the work order |
| opened_at | TIMESTAMP | Timestamp when the work order was opened |
| resolved_at | TIMESTAMP | Timestamp when the work order was resolved |