Link to home
Start Free TrialLog in
Avatar of fullbugg
fullbugg

asked on

UPDATE query with Select from two databases

Hello,
I have to update a column in one database based on a select query that is between two databases checking for a null. This is what I have:

UPDATE db1.dbo.products  
SET active = '0'
FROM (SELECT db1.dbo.products.sku
      FROM db1.dbo.products
      LEFT JOIN db2.dbo.item ON db1.dbo.products.sku = db2.dbo.item.itemlookupcode
      WHERE db2.dbo.item.itemlookupcode IS NULL)

I am getting an invalid syntax error at ")"
I can't see what is wrong... please help.

ASKER CERTIFIED SOLUTION
Avatar of 8080_Diver
8080_Diver
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of fullbugg
fullbugg

ASKER

8080_Diver ... Thanks so much... That did the trick