Advertisement

05.23.2003 at 06:15PM PDT, ID: 20625051
[x]
Attachment Details

Update from multiple tables

Asked by jhdaniel in Oracle Database

Tags: update, multiple, tables

The question below comes from this site.  It's an accepted answer.  However, this syntax doesn't work for me.  I get an error on the comma (after carts c,) that I'm missing the SET keyword.  1) Is the syntax below incorrect, and 2) if it is incorrect, then how can you update multiple rows using data from other columns, the way it's described below?  

<<
the above update is incorrect :

UPDATE carts SET carts.format_code = prices.format_code
WHERE cart_item_id IN
      (SELECT cart_item_id from prices, carts
       WHERE  blah blah blah.....)

the 'prices' table is unknown to the update statement, and only exists in the sub-select.

However, you can issue the following update commnad in order to get the requested affect :
UPDATE carts c, prices p
SET c.format_code = p.format_code
WHERE c.cart_item_id IN
      (SELECT t.cart_item_id from prices r, carts t
       WHERE  r.<price_table_key> = p.<price_table_key>
      AND    blah blah blah.....)

Hope it answered your question.
>>
Start Free Trial
[+][-]05.23.2003 at 06:22PM PDT, ID: 8575687

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.23.2003 at 06:28PM PDT, ID: 8575700

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.23.2003 at 06:29PM PDT, ID: 8575701

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.23.2003 at 06:34PM PDT, ID: 8575713

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.23.2003 at 06:36PM PDT, ID: 8575724

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.23.2003 at 08:23PM PDT, ID: 8575961

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: Oracle Database
Tags: update, multiple, tables
Sign Up Now!
Solution Provided By: venkotch
Participating Experts: 4
Solution Grade: A
 
 
[+][-]05.24.2003 at 10:12AM PDT, ID: 8577843

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 7-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]05.25.2003 at 06:08PM PDT, ID: 8581759

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 7-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]09.02.2004 at 05:21PM PDT, ID: 11969446

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 7-day free trial to view this Administrative Comment or ask the Experts your question.

 
[+][-]09.06.2004 at 12:10PM PDT, ID: 11991603

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 7-day free trial to view this Administrative Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32