I'm trying to copy the column 'REGEX_MIN_DATE' from one table to another, matching on another column, 'MSCAD_ID'. Both tables have these columns. Why does the following code fail?
UPDATE dbo.std_cyber_mscad_cases
SET REGEX_MIN_DATE = dbo.temp_min_dates.REGEX_MIN_DATE
WHERE MSCAD_ID = dbo.temp_min_dates.MSCAD_ID
I'm getting the error 'The multi-part identifier "dbo.temp_min_dates.MSCAD_ID" could not be bound.'
CodePudding user response:
UPDATE A
SET REGEX_MIN_DATE = B.REGEX_MIN_DATE
FROM dbo.std_cyber_mscad_cases A
INNER JOIN dbo.temp_min_dates B ON A.MSCAD_ID = B.MSCAD_ID