Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: Problem with update uses two tables

Re: Problem with update uses two tables

From: Brian Tkatch <N/A>
Date: Wed, 12 Sep 2007 09:04:57 -0400
Message-ID: <mhofe3pfhu1u25tcu6rm9sm595hoi88no6@4ax.com>


On Wed, 12 Sep 2007 07:16:02 -0000, Waldemar Dacko <dackow_at_gmail.com> wrote:

>Hi,
>I've had a problem with (probably) simple query. I want to update one
>field in one table when another field in this table is equal to
>another field in another table (they have the same type of course).
>This should be something like this (each table has two field - id and
>x):
>
>update tabX set tabX.x = tabY.y where tabX.id = tabY.id
>
>but it doesn't working. Please tell me what is wrong with this query
>and how to change it.
>
>WD

The query is wrong because TabY is referenced without being included. Though it could not be incuded directly, as this is an UPDATE statement.

The way to change it would be to use a correlated sub-query to retrieve that data to UPDATE with.

B. Received on Wed Sep 12 2007 - 08:04:57 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US