Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: SQL-Question: Transformation of a column
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.comReceived on Mon Nov 03 2003 - 11:01:47 CST
![]() |
![]() |