franklin1232
IS-IT--Management
This is a simple update query, but it is causing me problems. The inner SELECT returns only rows with matching PLUNum through the INNER JOIN. However when K_Menu and C_Menu are joined there are addtional records returned and the PLUNum values for those addtional records is NULL. QSRCat and QSRDept that were already set in the C_Menu and shouldn't be changed by the query are set to NULL.
I tried simple PLUNum IS NOT NULL statement but I get correlation table errors. I tried to create alias but didn't work.
UPDATE C_Menu
SET QSRDept =
(SELECT PLUTable.QSRDept
FROM K_Menu INNER JOIN
PLUTable ON K_Menu.PLU = PLUTable.PLUNum
WHERE C_Menu.MenuID = K_Menu.MenuID)
UPDATE C_Menu
SET QSRCat =
(SELECT PLUTable.QSRCat
FROM K_Menu INNER JOIN
PLUTable ON K_Menu.PLU = PLUTable.PLUNum
WHERE C_Menu.MenuID = K_Menu.MenuID)
I tried simple PLUNum IS NOT NULL statement but I get correlation table errors. I tried to create alias but didn't work.
UPDATE C_Menu
SET QSRDept =
(SELECT PLUTable.QSRDept
FROM K_Menu INNER JOIN
PLUTable ON K_Menu.PLU = PLUTable.PLUNum
WHERE C_Menu.MenuID = K_Menu.MenuID)
UPDATE C_Menu
SET QSRCat =
(SELECT PLUTable.QSRCat
FROM K_Menu INNER JOIN
PLUTable ON K_Menu.PLU = PLUTable.PLUNum
WHERE C_Menu.MenuID = K_Menu.MenuID)