Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Update with inner join 2

Status
Not open for further replies.

jimmyshoes

Programmer
Jun 1, 2008
132
GB
I am trying to combine the update statement with an inner join
Code:
Update Table1 INNER JOIN Table2
On table1Col = table2Col
SET somefield = 'New Name'

(Both tables have unique field names so I have not used AS )

I am getting the error 'Incorrect syntax near the keyword 'INNER'.'
 
Code:
Update Table1 SET somefield = 'New Name'
FROM Table1
INNER JOIN Table2 On table1Col = table2Col


Borislav Borissov
VFP9 SP2, SQL Server 2000/2005.
 
If someFieldTable1 is a field in Table1 and someFieldTable2 is a field in Table2, is it possible to modify the above code to set someFieldTable1 to 'newValueFor1' and someFieldTable2 to 'newValueFor2'
 
No, the UPDATE statement can only update one table at a time in SQL Server.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top