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

Home -> Community -> Usenet -> c.d.o.server -> Re: Problem with update

Re: Problem with update

From: Mark D Powell <Mark.Powell_at_eds.com>
Date: 8 Jul 2006 16:30:42 -0700
Message-ID: <1152401442.856867.172750@75g2000cwc.googlegroups.com>

Bob Jones wrote:
> "Identity" <id_at_id.it> wrote in message
> news:44afba4f$0$10064$4fafbaef_at_reader3.news.tin.it...
> > I've a table "Table1" with:
> >
> > ID - Cod - Type - Value - Period
> > 1-COD1-AAA-0-Jan
> > 2-COD2-BBB-0-Feb
> > 3-COD3-AAA-0-Feb
> > 4-COD4-CCC-0-Feb
> >
> > Now I want to UPDATE this records using a Second Table "Table2"
> >
> > Type-Qt-Value-Period
> > AAA-10-10-Jan
> > AAA-3-2-Feb
> > BBB-3-2-Feb
> > CCC-4-6-Feb
> > ....
> >
> > If, in table1, I've AAA I want to search in table2 the value of type AAA
> > in
> > the table1.period
> > If, in table1, I've BBB I want to search in table2 the value of type BBB
> > in
> > the table1.period
> >
> >
> > How Can I create this update??
> >
> > After the UPDATE, I would like to obtain:
> >
> > ID - Cod - Type - Value - Period
> > 1-COD1-AAA-100-Jan (value = 10*10)
> > 2-COD2-BBB-6-Feb (value = 3*2)
> > 3-COD3-AAA-6-Feb (value = 3*2)
> > 4-COD4-CCC-24-Feb (value = 6*4)
> >
> > Thanks
>
> update table1
> set value = (select qt*value from table2
> where table2.type = table1.type
> and table2.period = table1.period)

Bob is right assumming that there will only be one type value hit per period in table_2. Should have finished my coffee before booting up.

Received on Sat Jul 08 2006 - 18:30:42 CDT

Original text of this message

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