I am updating two columns from 2 tables but getting Exception message:
The multi-part identifier "item_t1.Code" could not be bound
UPDATE item_t0
SET
item_t0.p_enddate = DATEADD(d, -29, GETDATE()),
item_t1.Code = 'Inactive'
FROM employee item_t0
JOIN dept item_t1 ON item_t0.id = item_t1.empid
WHERE
(item_t0.p_enddate IS NOT NULL and item_t1.Code in ('Active', 'Pending')) AND
item_t0.p_empid = 11636