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
--------------------------



------------------------------------

------------------------------------

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Visit http://www.firebirdsql.org and click the Documentation item
on the main (top) menu.  Try FAQ and other links from the left-side menu there.

Also search the knowledgebases at http://www.ibphoenix.com/resources/documents/ 

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
------------------------------------

Yahoo Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/firebird-support/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/firebird-support/join
    (Yahoo! ID required)

<*> To change settings via email:
    [email protected] 
    [email protected]

<*> To unsubscribe from this group, send an email to:
    [email protected]

<*> Your use of Yahoo Groups is subject to:
    https://info.yahoo.com/legal/us/yahoo/utos/terms/

Reply via email to