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 -> How to make sum of columns in 1 row be starting point for next row

How to make sum of columns in 1 row be starting point for next row

From: sfdsf <tyutuyt_at_gfd.com>
Date: 11 Jan 2003 14:35:36 -0600
Message-ID: <3e207f8c$0$22152$45beb828@newscene.com>


We have sales data for products on a year basis for a 5 year forecast. For year 1 we add the base price + shipping + tax to get the total price. that total price then becomes the base price for the next year. so for product A1 we have the following

name base_cost shipping tax total year

A1              10              0                  3           15           1
A1              15              2                    1           18          2
A1              18              1                    6          26           3
etc            

So to report the forecast we just select the above rows displaying them for each year (in fact the table was premade for just that purpose (reason was first intital base cost was very complex and time comsuming to calculate.)

Problem is that they want to see a forecast minus the impact of shipping costs. What will it be if the shipping cost is zero for all years? Of course that is not how the data is in the table. I can't just do a select like in the first one. All the data is in the table, problem is how to select it right.

The total for Row 1 needs to be the base cost for row 2 and so on..

Any ideas on how this can be done without doing it in stored procedure ( user function or analytic function would be great)? this is going to be used in a report program that can not call stored procedures. I am at wits end! Received on Sat Jan 11 2003 - 14:35:36 CST

Original text of this message

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