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 -> Re: Help with select statement (pivot table?)

Re: Help with select statement (pivot table?)

From: DA Morgan <damorgan_at_x.washington.edu>
Date: Thu, 28 Apr 2005 21:45:16 -0700
Message-ID: <1114749681.658085@yasure>


albundy1998_at_hotmail.com wrote:

> 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
And you are doing this in SQL*Plus or Crystal Reports or ....? And what version?

Do you know SQL and you want a hint or are you looking for someone to do your work for you?

-- 
Daniel A. Morgan
University of Washington
damorgan_at_x.washington.edu
(replace 'x' with 'u' to respond)
Received on Thu Apr 28 2005 - 23:45:16 CDT

Original text of this message

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