
Write a PostgreSQL query for Qlik planning data that handles missing amount values for January 2024. Return each plan record with its account and manager, keep the original amount when present, otherwise fill from the account default, and fall back to 0 if both are missing. Also label each row with the fill method used.
| Column | Type | Description |
|---|---|---|
| record_id | ||
| account_id | ||
| manager_id | ||
| plan_month | ||
| amount |
| Column | Type | Description |
|---|---|---|
| account_id | ||
| account_name | ||
| default_amount |
| Column | Type | Description |
|---|---|---|
| manager_id | ||
| manager_name |