2016-11-13 11 views
0

次の表は、日付Ascによって発注されました。 Progressively Netvの列が必要です。Progressively列Netv for eatch行。Oracleクエリの累積量

ID  Type  Date  NetV Debit Credit Vat Progressively NetV 
177485 Invoice 23/12/2015 900 1107  0 1.23 900 
177485 transfer 14/1/2016  0  0 1107  0 900 
177485 Invoice 24/3/2016  900 1107  0 1.23 1800 
177485 transfer 27/5/2016  0  0 1107  0 1800 
177485 Invoice 30/6/2016  900 1116  0 1.24 2700 
177485 transfer 5/8/2016  0  0 1116  0 2700 
177485 Invoice 28/9/2016  900 1116  0 1.24 3600 
177485 transfer 4/11/2016  0  0 1116  0 3600 

答えて

1

あなたの質問は少し不明です。私が理解していることは、あなたが次のようなものを持ちたいということです:

select id, type, date, NetV, Debit, Credit, Vat, 
     sum(NetV) over (partition by id order by date) as ProgressivelyNetV 
    from table1;