MySQL Forums
Forum List  »  Oracle

UPDATE using SELECT
Posted by: Chris Grocott
Date: February 11, 2005 11:45AM

Coming from an Oracle background I am used to doing this:

UPDATE accomodation a
SET a.country = (SELECT c.country
FROM country c
WHERE c.country_id = a.country_id);

I could not ge thtis to work so looked up the syntax for this:

update accomodation a
join country c on a.country_id=c.country_id
set a.country=c.country;

Which doesn't work either !!! Basically I am trying to do an update using a select from another table rather than a static value but cannot get it to work. Is this possible in MySQL ?

Chris

Options: ReplyQuote


Subject
Views
Written By
Posted
UPDATE using SELECT
210226
February 11, 2005 11:45AM
90068
August 12, 2005 04:30AM
51659
June 04, 2009 06:55AM
35910
July 18, 2009 01:18AM


Sorry, you can't reply to this topic. It has been closed.
This forum is currently read only. You can not log in or make any changes. This is a temporary situation.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.