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: SQL-Question: Transformation of a column

Re: SQL-Question: Transformation of a column

From: andrewst <member14183_at_dbforums.com>
Date: Mon, 03 Nov 2003 12:01:47 -0500
Message-ID: <3553517.1067878907@dbforums.com>

As long as you know in advance the periods involved:

select name

, sum(decode(period,'2003-7',value,0)) as "2003-7"

, sum(decode(period,'2003-8',value,0)) as "2003-8"

, sum(value) as total

from table

group by name;

It's fairly easy to write a program to generate this SQL for you to cater for the addition of future periods.

--
Posted via http://dbforums.com
Received on Mon Nov 03 2003 - 11:01:47 CST

Original text of this message

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