I have 2 tables RDR1 and ORDR. I currently use the below CASE
statement to update the column UomCode
in the RDR1
table:
Updated code below with the answer Update RDR1 Set UomCode = (CASE
WHEN LineStatus = 'C' and DelivrdQty = 0 THEN ''
WHEN LineStatus = 'C' and EncryptIV = NULL THEN 'DESPATCHED'
WHEN Quantity = DelivrdQty THEN 'DELIVERED'
WHEN DelivrdQty = '0' THEN 'AWAITING STOCK'
WHEN DelivrdQty < Quantity THEN 'PART SHIPPED'
Else 'ERROR' End)
from ORDR
inner join RDR1
On ORDR.DocEntry = RDR1.DocEntry
This works fine but I want to add a new line but that line requires a join but from reading examples online I cannot figure out where to put the join. The 2 tables join on a column called DocEntry
The statement will be
WHEN RDR1.LineStatus = 'C' AND ORDR.U_ActualDel = NULL
Can anyone point me to an example or let me know where to put the join please?