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: [Q:] SQL question

Re: [Q:] SQL question

From: Thomas Kyte <tkyte_at_us.oracle.com>
Date: 1998/01/16
Message-ID: <34bebcdf.243685701@inet16>#1/1

On Thu, 15 Jan 1998 21:24:44 +0100, Johann Tinnacher <j-tinnacher_at_netway.at> wrote:

>hello everybody!
>
>i'm looking for a SQL-Statement. see my tables:
>
>Table a PARTNO WEIGHT DATA_A DATA_B
> ========================================
> PART_01 10 aaa bbb
> PART_02 12 aaaa bbbb
> PART_02 14 02020202 02020202
> PART_03 12 s xxx
>
>Table b PARTNO DATA_A DATA_B
> =============================
> PART_01
> PART_02
> PART_03
>
>

update table_b

   set (data_a,data_b) = ( select data_a, data_b

                             from table_a
                            where table_a.partno = table_b.partno
                              and table_a.weight = 
                                        ( select max(weight)
                                            from table_a
                                           where partno = table_b.partno )
                          )


>The script should update columns within table b with DATA_x
>of table a where WEIGHT ist max. WEIGHT of each PARTNO
>
>table b should be:
>
>PARTNO DATA_A DATA_B
>==============================
>PART_01 aaa bbb
>PART_02 02020202 02020202
>PART_03 s xxx
>
>
>how should i do that?
>
>
>many thanks.
>
>
>-----------------
>Johann Tinnacher
>Posch Ges.m.b.H.
>
>(j-tinnacher_at_netway.at)
 

Thomas Kyte
tkyte_at_us.oracle.com
Oracle Government
Bethesda MD  

http://govt.us.oracle.com/ -- downloadable utilities  



Opinions are mine and do not necessarily reflect those of Oracle Corporation  

Anti-Anti Spam Msg: if you want an answer emailed to you, you have to make it easy to get email to you. Any bounced email will be treated the same way i treat SPAM-- I delete it. Received on Fri Jan 16 1998 - 00:00:00 CST

Original text of this message

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