Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Query to carry forward

1023249Jul 8 2013 — edited Jul 9 2013

Hi all

I am trying to carry forward the YTD transactional data to next consecutive months with in the FY.I can get the aggregated value using Partition By/ Order by function but couldn't carry forward to consecutive months if they don't have any transaction.

Below is the scenario:

Product Name     org                  date                 total order       net sales    

abc                      a01              1/1/2013                200              100

def                       d01            1/3/2013                 100               100

abc                       a01             1/25/2013              100               100

abc                       a01               2/5/2013              100               50

def                       d01               3/2/2013               50                50

abc                       a01                4/5/2013             100              100

abc                       a01                 7/5/2013            100             100

When I am sending the data on july 8th it should look like:

Abc        ao1           1/1/2013                       300         200

Def         d01            1/1/2013                      100          100

Abc        ao1           2/1/2013                      400         250

Def         d01            2/1/2013                      100          100

Abc        ao1           3/1/2013                      400         250

Def         d01            3/1/2013                      150          150

Abc        ao1           4/1/2013                      500         350

Def         d01            4/1/2013                      150          150

Abc        ao1           5/1/2013                      500         350

Def         d01            5/1/2013                      150          150

Abc        ao1           6/1/2013                      500         350

Def         d01            6/1/2013                      150          150

Abc        ao1           7/1/2013                      600         450

Def         d01            7/1/2013                      150          150

:

I really appreciate your help..Thanks,

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 6 2013
Added on Jul 8 2013
3 comments
830 views