Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Help with select statement (pivot table?)

Help with select statement (pivot table?)

From: <albundy1998_at_hotmail.com>
Date: 28 Apr 2005 16:51:42 -0700
Message-ID: <1114732302.054729.79250@g14g2000cwa.googlegroups.com>


I'm a sql novice. I'm trying to write a financial report. I need a sql statement that will add a range of fields (periods). See table and example below..

Fields: Year, Account, Period1, Period2, Period3, ..., Period12 Values: 2005, 12345, 100, 200, 300, ..., 1200

The user will pick the year, account, and any period range. For example the user picks Year 2005, Account 12345, and wants periods 1 - 12. Next time the user will want periods 1 - 3 or 6 - 8 or any range of periods. I wonder if there's a sql statement to dynamically handle this.

I'm thinking about creating a pivot table to rearrange the data to:

Year, Periods, Amounts
2005, Period1, 100
2005, Period2, 200
2005, Period3, 300

...
2005, Period12, 1200

And then summing the Periods field if the period is between the range the user wants. Any ideas on how to do this?

TIA... AL Received on Thu Apr 28 2005 - 18:51:42 CDT

Original text of this message

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