How do I do a JOIN in an UPDATE with SQL Server
June 22, 2011
I’m working on some client work on Classic ASP and SQL Server. I needed to do an UPDATE with a JOIN and ran across an issue. As with most things T-SQL, the syntax differs from the ANSI standard. Here’s how to do it:
UPDATE p
SET p.[Paid] = '0'
FROM [profiles] p, [registered] r
WHERE p.[ID] = r.[ID] AND r.[subscription_id] = @subscription_id