Your question is Reconcile Multi-Source Cost Variances. Start with the requirements and the three tables on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
Write a PostgreSQL query that reconciles March 2024 program costs between an ERP source and a plant reporting source. Return only programs where the two sources do not balance, along with both totals, the absolute variance, and a status showing whether the issue is a missing source or a mismatch.
| Column | Type | Description |
|---|---|---|
| program_id | ||
| program_code | ||
| platform_name |
| Column | Type | Description |
|---|---|---|
| cost_id | ||
| program_id | ||
| posting_date | ||
| cost_type | ||
| amount |
| Column | Type | Description |
|---|---|---|
| plant_entry_id | ||
| program_code | ||
| report_month | ||
| amount |