Subject | How write a query with a progressive sum field |
---|---|
Author | Luigi Siciliano |
Post date | 2016-03-07T10:16:44Z |
Hallo,
I need to write a query with a computed field that contain a
progressive sum like this table:
DATA DOCUMENTO_ID NUMERO SERIE CARICO SCARICO SALDO
01/01 A 1 A
1 0 1
02/01 A 2 A
3 0 4
02/01 V 33 B
0 2 2
02/01 V 35 C
0 1 1
I need to modify this query by adding SALDO field to get progressive sum
of CARICO - SCARICO:
select
DT.DATA,
DT.DOCUMENTO_ID,
DT.NUMERO,
DT.SERIE,
DC.CARICO,
DC.SCARICO
from
DOC_TESTA DT
JOIN DOC_CORPO DC on DT.ID = DC.DOC_TESTA_ID
WHERE
DC.ARTICOLO_ID = :ID
ORDER BY
DATA,
DOCUMENTO_ID,
NUMERO,
SERIE
How I do?
Thanks
--
Luigi Siciliano
--------------------------
I need to write a query with a computed field that contain a
progressive sum like this table:
DATA DOCUMENTO_ID NUMERO SERIE CARICO SCARICO SALDO
01/01 A 1 A
1 0 1
02/01 A 2 A
3 0 4
02/01 V 33 B
0 2 2
02/01 V 35 C
0 1 1
I need to modify this query by adding SALDO field to get progressive sum
of CARICO - SCARICO:
select
DT.DATA,
DT.DOCUMENTO_ID,
DT.NUMERO,
DT.SERIE,
DC.CARICO,
DC.SCARICO
from
DOC_TESTA DT
JOIN DOC_CORPO DC on DT.ID = DC.DOC_TESTA_ID
WHERE
DC.ARTICOLO_ID = :ID
ORDER BY
DATA,
DOCUMENTO_ID,
NUMERO,
SERIE
How I do?
Thanks
--
Luigi Siciliano
--------------------------