|
-
Recursive Sub Query
We have to prepare a report like this.
Column 1 : Factory
Column 2 : Capacity
Column 3 : Demand
Column 4 : Actual Demand (Demand for Current Factory + Backlog from the previous Factory)
Column 3 : Backlog (If (Capacity < ActualDemand) then (Capacity - Actual Demand) else 0)
Sample Report like :
Factory Capacity Demand ActualDemand Backlog
1 100 80 80 0
2 50 40 40 0
3 100 150 150 50
4 30 20 70 40 ActualDemand=70(20 Current + 50 previous "Backlog")
5 80 30 70 0 ActualDemand=70(30 Current + 40 previous "Backlog")
6 100 70 70 0
In the above report, we have to include the previous rows' backlog quantity for calculating "Actual Demand" of the current row.
I have a rough idea of using recursive sub queries, but not an expert.
Can you provide a SQl solution for this.
Would be really helpful.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|