There are 2 tables : Sales & Transaction. I need to update the INDICATOR column of the Sales table using CASE WHEN by joining these two tables.
Using below query but not working :
Update Sales a set
a.indicator=
CASE WHEN a.retail_value >= t.selling_price then 'Y'
WHEN a.retail_value < t.selling_price then 'N'
ELSE NULL
END
FROM Transaction t
WHERE a.id = t.id and a.date <= t.date;