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
209744
February 11, 2005 11:45AM
89933
August 12, 2005 04:30AM
51527
June 04, 2009 06:55AM
35751
July 18, 2009 01:18AM


Sorry, you can't reply to this topic. It has been closed.

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.