Just demo. I have two table
Table a (id, name)
--id---name----
1 John
2 Jack
3 Maria
4 Bill
Table b (id, empid, datewrk)
--id---empid----datewrk----
1 1 2012-12-12
2 2 2012-12-14
3 3 2012-12-16
4 4 2012-12-17
I want update all name = null in table a where date in table b <= '2012-12-14', the result is
--id---name--
1 NULL
2 NULL
I have try code bellow but no work (only work with SELECT statement). I try in MySql Workbench and SQL Server 2012
UPDATE a
SET name = NUll
WHERE id IN (SELECT a.id FROM a
JOIN b ON a.id = b.empid
WHERE b.datewrk <= '2012-12-14');
Thank.