[dba-SQLServer] UPDATE syntax with JOIN

Michael Maddison michael at ddisolutions.com.au
Tue Jul 5 20:05:22 CDT 2005


Hi Susan,

This is the syntax you require.

UPDATE    [Table1]
SET [Field] = [NewValue]
FROM [Table1] INNER JOIN [Table2] ON
[Table1].[Field] = [Table2].[Field]
WHERE [criteria]

Cheers

Michael M


UPDATE Authors
INNER JOIN AuthorsPublicationsmm
ON Authors.AuthorID = AuthorsPublicationsmm.AuthorIDFK SET
AuthorsPublicationsmm.AuthorIDGUIDFK = [Authors].[AuthorIDGUID] WHERE
(([Authors].[AuthorID]=[AuthorsPublicationsmm].[AuthorIDFK]))
 
======The above statement runs in Access just fine, but I get an error
on INNER JOIN in SQL Server. I checked bol, but geez... what a mess that
was.
:( 
 
I'm trying to update the AuthorIDGUIDFK value in a many to many table
based on the AUthorIDGUID value in Authors.
 
Thanks!
Susan H. 
_______________________________________________
dba-SQLServer mailing list
dba-SQLServer at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/dba-sqlserver
http://www.databaseadvisors.com




More information about the dba-SQLServer mailing list