Write a SQL query to compare physical inventory counts against ERP records and return items with discrepancies by warehouse and product at AkzoNobel.
Use the inventory count and ERP inventory tables for the 2025-03-31 snapshot. Treat a missing side as quantity zero and aggregate multiple physical count rows for the same warehouse and product.
warehouse_code, product_code, physical_qty, erp_qty, discrepancy_qty, and discrepancy_typewarehouse_code, then product_code| Column | Type | Description |
|---|---|---|
| count_idPK | INT | Unique physical count record identifier |
| warehouse_code | VARCHAR(20) | Warehouse identifier |
| product_code | VARCHAR(30) | AkzoNobel product identifier |
| counted_qty | INT | Quantity recorded during the physical count |
| count_date | DATE | Date of the physical inventory count |
| Column | Type | Description |
|---|---|---|
| record_idPK | INT | Unique ERP inventory record identifier |
| warehouse_code | VARCHAR(20) | Warehouse identifier |
| product_code | VARCHAR(30) | AkzoNobel product identifier |
| recorded_qty | INT | Quantity recorded in the ERP system |
| snapshot_date | DATE | ERP inventory snapshot date |