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: help with a query

Re: help with a query

From: f morel <florian.morel_at_actiware.fr>
Date: Thu, 24 Aug 2000 17:53:38 +0200
Message-ID: <8o3gd3$q45$1@wanadoo.fr>

It seems to be complex.... could you try the following query? Please tell me if it works!!

select t1.id as type1, t1.value as value1,

          t2.id as type2, t2.value as valu2,
          t0.id as type0, t0.value as value0
from
(select rownum as ord1, id, value from table where type=1
order by id) t1,
(select rownum as ord2, id, value from table where type=2
order by id) t2,
(select rownum as ord3, id, value from table where type=0
order by id) t0
where ord1 = ord2(+)
and ord1 = ord3(+)

"Jorge Castro" <jrcastro_at_ceibo.entelnet.bo> wrote in message news:8nummv$9tf$1_at_nnrp1.deja.com...
> Hi everyone. I need help.
>
> I have this data in a table:
>
> TYPE ID VALUE
> ---------- ---------- ----------
> 1 0 5000
> 1 11 500
> 1 9 25
> 1 8 800
> 1 10 0
> 1 7 200
> 2 6 85,5
> 2 5 1068,75
> 2 4 676,85
> 1 3 15
> 1 2 2000
> 1 1 10
> 0 19 0
> 0 24 0
> 0 20 0
> 2 14 0
> 1 13 0
> 1 12 0
> 2 18 45
> 2 17 45
> 2 16 20
> 2 15 456
> 0 21 0
> 0 23 100
> 0 22 0
>
> and I want to make a query that show it like this:
>
> TYPE1 VALUE1 TYPE2 VALUE2 TYPE0 VALUE0
> ---------- ---------- ---------- ---------- ---------- ----------
> 0 5000 4 676,85 19 0
> 1 10 5 1068,75 20 0
> 2 2000 6 85,5 21 0
> 3 15 14 0 22 0
> 7 200 15 456 23 100
> 8 800 16 20 24 0
> 9 25 17 45
> 10 0 18 45
> 11 500
> 12 0
> 13 0
>
> anyone can help me. Thanks.
>
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
Received on Thu Aug 24 2000 - 10:53:38 CDT

Original text of this message

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