A logistics company wants to identify recurring maintenance problems at each facility. Write a SQL query that analyzes work orders created during the one-year period ending on September 26, 2026, and returns the most frequent issues for each facility.
facility_id, facility_name, issue_id, issue_name, and issue_count.issue_name ascending, then issue_id ascending. Order the final result by facility_id, issue_count descending, issue_name ascending, and issue_id ascending.| Column | Type | Description |
|---|---|---|
| facility_idPK | INT | Unique facility identifier |
| facility_name | VARCHAR(100) | Facility display name |
| region | VARCHAR(50) | Operational region |
| Column | Type | Description |
|---|---|---|
| issue_idPK | INT | Unique maintenance issue identifier |
| issue_name | VARCHAR(100) | Maintenance issue description |
| severity | VARCHAR(20) | Issue severity classification |
| Column | Type | Description |
|---|---|---|
| work_order_idPK | INT | Unique work order identifier |
| facility_id | INT | Facility associated with the work order |
| issue_id | INT | Maintenance issue associated with the work order |
| created_at | DATE | Work order creation date |
| status | VARCHAR(30) | Current work order status |