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: Query Resultset

Re: Query Resultset

From: Lars Tetzlaff <lars.tetzlaff_at_gmx.net>
Date: Thu, 04 Jan 2007 11:51:30 +0100
Message-ID: <enimi0$sjm$02$1@news.t-online.com>


Muggle wrote:
> Hello everyone,
>
> I need to execute a complex query and I have managed to generate the
> following resultset
>
> ID STATUS VALUE
> -------------------------------------
>
> 1 A value1
> 1 B value2
> 1 C value3
> 2 A value4
> 2 B value5
> 2 C value6
> 3 A value7
> 3 B value8
> 3 C value9
>
> Using this result I want to generate the following resultset
>
> ID ST_A ST_B ST_C
> --------------------------------------------------------
> 1 value1 value2 value3
> 2 value4 value5 value6
> 3 value7 value8 value9
>
> Can I do that using a query ? Or should do it programmatically in the
> application that retrieves the first resultset ?
>
> Thanks in advance
> Muggle
>

assuming that your data is stored in mytable i would try

select a.id ID, a.value ST_A, b.value ST_B, c.value ST_C from mytable a, mytable b, mytable c
where a.id = b.id and b.id = c.id
and a.status = A and b.status = B and c.status = C

Lars Received on Thu Jan 04 2007 - 04:51:30 CST

Original text of this message

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