Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
koushik
Starting Member
11 Posts |
Posted - 2010-09-13 : 02:53:01
|
I have the following dataset :Cust Prod MonthId QuantityC1 P1 201001 5C1 P1 201003 7C2 P2 201002 7C2 P2 201001 4C2 P2 201003 6And I want to generate the following :Cust Prod MonthId Quantity QuantityYTD (Running Total) CommentsC1 P1 201001 5 5 C1 P1 201002 0 5 Dummy row need to be created for Month 201002 & C1, P1 combinationC1 P1 201003 7 12 C2 P2 201002 7 7 C2 P2 201001 4 11 C2 P2 201003 6 17 Can you please let me know the best way (query can give good performance) to achieve this.Regards,Koushik Chandra |
|
CSears
Starting Member
39 Posts |
Posted - 2010-09-13 : 13:25:22
|
Do you have a table that contains all the possible values for MonthID, Cust, and Prod? |
 |
|
|
|
|