I have set of data, which shows minutes used by a "child contract" on a daily basis. I need to have a running total of the minutes consumed by the child contract so that we can keep track.
This is the code I used.
Select
"combined"."id",
"combined"."ContractCustomer",
"combined"."ContractCustomerChild",
"combined"."Minutes",
SUM( "combined"."Minutes") OVER (PARTITION BY "combined"."ContractCustomerChild" ORDER BY "combined"."id") As "CustomerMinutes",
FROM "dbo"."combined"
I expect the sum to be restart for every contract child, however, it does seem to behave that way.
This is the result i got:
ID CustomerContractChild Minutes CustomerMinutes 1 20150101+C1 1000 1000 2 20150101+C1 2000 3000 3 20150101+c2 2500 5500
This is what I expect
ID CustomerContractChild Minutes CustomerMinutes 1 20150101+C1 1000 1000 2 20150101+C1 2000 3000 3 20150101+c2 2500 2500
What did I do wrongly?