Write a SQL query to join staffing, inventory, and sales tables to identify sites with declining throughput and rising labor cost.
Calculate monthly throughput as processed units divided by average ending inventory. Compare each site's current month with its immediately preceding month, excluding comparisons with missing prior values.
Output
- One row per site and qualifying current month
- Columns:
site_id, current_month, prior_throughput, current_throughput, prior_labor_cost, current_labor_cost
- Include only sites where throughput decreased and labor cost increased
- Order by
site_id, then current_month