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: Atbir Oumlil <belq_at_netrover.com>
Date: 1998/01/16
Message-ID: <34C01603.DCE81AB5@netrover.com>#1/1

Try this and let me know if it works because right now I can't test it: update b t1
set (DATA_A,DATA_B)=
(select t2.DATA_A,t2.DATA_B
from a t2,
(select PART_NO, MAX(WEIGHT) WEIGHT
 from a
 group by PART_NO) t3
where t2.PART_NO=t3.PART_NO
and t2.WEIGHT=t3.WEIGHT and t2.PART_NO=t1.PART_NO) where t1.PART_NO=t2.PART_NO;

Rachid Belquas

Johann Tinnacher 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
>
> 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)
Received on Fri Jan 16 1998 - 00:00:00 CST

Original text of this message

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