Differences

This shows you the differences between two versions of the page.

Link to this comparison view

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. ​ Within Control, editing and saving these parts will automatically recreate the missing entries.
 +
 +
 +
 +===== Risk of Data Corruption if Run Improperly =====
 +
 +**None**. ​ This is a selection query and no data is modified in the running of it.
 +
 +
 +
 +===== SQL =====
 +
 +
 +
 +<code sql>
 +select P.ID as PartID, P.ItemName as PartName, W.ID as WarehouseID,​ W.WarehouseName
 +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)
 +</​code>​
 +
 +
 +
 +===== Version Information =====
 +  * Entered : 3/2013
 +  * Version : 5.1
 +
 +
 +