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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Update Statement Problem 1

Status
Not open for further replies.

EnemyGateIsDown

Technical User
Oct 3, 2002
235
GB
Hi guys,

I am trying to write an update statement which updates a single table but I need to reference another table in order to get the data I need. The query currently looks like:

Code:
update reservations, rooms set reservations.room_id = rooms.room_id 
where 
reservations.roomname = rooms.[Meeting Room]

However this query does not work.. I get the following error:

Code:
Server: Msg 170, Level 15, State 1, Line 1
Line 1: Incorrect syntax near ','.

Can someone help me with the syntax here as I cant seem to find a syntax which works.

Any help is as always greatly appreciated.

Cheers,

Chris
 
Code:
Update reservations set reservations.room_id = rooms.room_id
where reservations.roomname = rooms.[Meeting Room]

Borislav Borissov
VFP9 SP1, SQL Server 2000/2005.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top