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

Home -> Community -> Usenet -> c.d.o.tools -> Re: Newbie-Update with Mulitple Tables

Re: Newbie-Update with Mulitple Tables

From: Myron Wintonyk <mwintony_at_med.ualberta.ca>
Date: Mon, 26 Feb 2001 10:04:11 +1000
Message-ID: <3A999D7B.1BA40E49@med.ualberta.ca>

Try this:

Update TABLEA set TABLEA.Amount = (select TABLEA.Amount + TABLEB.Adjustment from

TABLEB
WHERE TABLEA.Period = TABLEB.Period AND TABLEA.Day = TABLEB.Day AND TABLEB.Type = 'A';

Peter Kalapuziak wrote:

> I'm new to Oracle SQL syntax - have used DB2 and Sybase and done the
> following quite easily with them, however not with Oracle. I'm currently
> developing in Personal Oracle 8i.
>
> I'm having a problem getting to the Oracle syntax of updating a column in
> one table using the value of another. What I want to do is the equivalent
> of:
>
> Update TABLEA set TABLEA.Amount = (TABLEA.Amount + TABLEB.Adjustment) from
> TABLEA, TABLEB
> WHERE TABLEA.Period = TABLEB.Period AND TABLEA.Day = TABLEB.Day AND
> TABLEB.Type = 'A';
>
> I've looked for this answer in many books, some Oracle based and others more
> general SQL types. They all show the "simpler" forms, but not something
> like this example specific to Oracle. I've tried many variations but all are
> syntactically incorrect.
>
> I have no problems doing many other SQL functions in Oracle 8i, just this
> one is causing me headaches - I'm sure the answer is very simple.
>
> Thanks in advance and would appreciate any help.
>
> Peter K.
Received on Sun Feb 25 2001 - 18:04:11 CST

Original text of this message

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