Differences
This shows you the differences between two versions of the page.
— |
control_sql_-_identify_missing_inventory_entries [2019/01/27 11:29] (current) |
||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== | ||
+ | |||
+ | |||
+ | |||
+ | ===== Explanation of SQL ===== | ||
+ | |||
+ | |||
+ | |||
+ | This query identified Parts that are inventories but are missing their entry in the Inventory table for a particular warehouse. | ||
+ | |||
+ | |||
+ | |||
+ | ===== Risk of Data Corruption if Run Improperly ===== | ||
+ | |||
+ | **None**. | ||
+ | |||
+ | |||
+ | |||
+ | ===== SQL ===== | ||
+ | |||
+ | |||
+ | |||
+ | <code sql> | ||
+ | select P.ID as PartID, P.ItemName as PartName, W.ID as WarehouseID, | ||
+ | from Part P, Warehouse W | ||
+ | where | ||
+ | P.ID > 0 | ||
+ | and P.TrackInventory = 1 | ||
+ | and W.ID > 0 | ||
+ | and not exists (select ID from Inventory I where I.PartID = P.ID and I.WarehouseID = W.ID) | ||
+ | </ | ||
+ | |||
+ | |||
+ | |||
+ | ===== Version Information ===== | ||
+ | * Entered : 3/2013 | ||
+ | * Version : 5.1 | ||
+ | |||
+ | |||
+ | |||