Write a SQL query to calculate monthly trends from a healthcare reporting table.
Use healthcare_reporting and facilities. Calculate monthly reporting activity for each facility, including the number of reports, total metric value, the previous month's total, and the month-over-month change. Exclude reports that cannot be matched to a facility.
facility_name, report_month, report_count, total_metric, previous_month_total, and month_over_month_change.| Column | Type | Description |
|---|---|---|
| report_idPK | INT | Unique reporting record identifier |
| facility_id | INT | Facility associated with the report |
| report_date | DATE | Date the report was recorded |
| report_type | VARCHAR(50) | Category of healthcare report |
| metric_value | NUMERIC(12,2) | Numeric value reported for the record |
| Column | Type | Description |
|---|---|---|
| facility_idPK | INT | Unique facility identifier |
| facility_name | VARCHAR(100) | Facility display name |
| region | VARCHAR(50) | Operational region of the facility |