You don't explain exactly what you want, but I surmise that you need an else
clause. If you want to set the value to 'N'
, then use:
UPDATE solr
SET Stock = (case when SUD.D_price = 'ABC' OR SUD.D_price = 'CDE' AND WIS.StockID > 0
THEN 'Y'
WHEN SUD.Display_price='XYZ ' OR SUD.Display_price='PQR' AND WIS.StockID>0 AND WI.StockName NOT LIKE '%GGR%'
THEN 'Y'
ELSE 'N'
end)
from solr SUD join
InventoryItems WIS
on WIS.ProductID = SUD.ProductId JOIN
WS_Inventory WI
ON WI.StockID = WIS.StockID;
Perhaps you want:
ELSE stock
This will not change the value. You can also put conditions in the where
clause to only update to Y
, if that is your intention. I don't see a need for if
.