Re: SQLPLUS question

From: Saad Ahmad <sahmad_at_mfa.com>
Date: 21 Feb 1995 20:21:08 GMT
Message-ID: <3idhvk$bb6_at_homer.alpha.net>


P.Sheth (cm4201_at_ccub.wlv.ac.uk) wrote:
> I need to produce a report in SQLPLUS which prints out rows..
> easy so far.. but the final column has to be an accumulation of each of
> the previous rows.
> e.g.
 

> Account Debt Accumulated Debt
> -------------------------------------
> A01 21 21
> A02 40 61
> A03 50 111
> A04 90 201

Try this, I think it would work
select a.account, a.debt, sum(b.debt)
from table b, table a
where b.account <= a.account
group by a.account, a.debt

--
**************************************************************
*                          Saad Ahmad                        *
*                          E-Mail: sahmad_at_mfa.com            *
**************************************************************
Received on Tue Feb 21 1995 - 21:21:08 CET

Original text of this message