Table of Contents

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

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)

Version Information