Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Query Generating Horizontal Totals
tranvirus wrote:
> Hi all,
>
> I have this table:
>
> Col1 Col2 Col3
> A A1 5
> A A2 3
> A A3 2
> A A4 4
> B B1 6
> B B3 8
> B B4 1
> C C1 3
> C C2 5
> C C3 8
> C C4 2
>
>
> I want to obtain this from my query:
>
> Col1 Col2 Col3 Col4 Col5
> A 5 3 2 4
> B 6 0 8 1
> C 3 5 8 2
>
> I guess there shuld be a way of doing this
> kind of operation in Oracle 9i but I don't
> find the right SQL query. All the help will
> be appreciated.
>
> Claudio Santana.
As this is school work ... a hint is in order ... look at the DECODE function.
-- Daniel Morgan http://www.outreach.washington.edu/ext/certificates/oad/oad_crs.asp http://www.outreach.washington.edu/ext/certificates/aoa/aoa_crs.asp damorgan_at_x.washington.edu (replace 'x' with a 'u' to reply)Received on Wed Feb 04 2004 - 16:40:23 CST