I have 2 tables with a date field that doesn't match that need to.
First I have a query to return a list of records that all need the Date field updated.
SELECT distinct ID_NUMBER
FROM a
INNER JOIN b
ON a.ID_NUMBER = b.ID_NUMBER
INNER JOIN c
ON c.ID_NUMBER = b.ID_NUMBER
INNER JOIN d
ON c.ID_NUMBER = d.ID_NUMBER
WHERE d.DATE <> b.DATE
returns 20K plus ID_NUMBER's
I want to update table B where the ID_Number = the list of ID_numbers from that query.
trying:
UPDATE b
SET d.DATE = b.DATE
Where (select distinct ID_NUMBER
from a
INNER JOIN b
ON a.ID_NUMBER = b.ID_NUMBER
INNER JOIN c
ON c.ID_NUMBER = b.ID_NUMBER
INNER JOIN d
ON c.ID_NUMBER = d.ID_NUMBER
Where d.DATE <> b.DATE
)
should be straightforward. Can't seem to get the syntax. Help appreciated.