Re: [SQL] Calc

2003-10-16 Thread Muhyiddin A.M Hayat
> > trx_date | trx_time | descriptions| > > payment_method | debet | credit | creator > > +--+--+ > >- ---+---+--+- > > 2003-10-09 | 21:55:02 | Resto Biling : 13,800, Paid : 10,00

Re: [SQL] Calc

2003-10-16 Thread Steve Crawford
On Thursday 16 October 2003 10:37 am, Muhyiddin A.M Hayat wrote: > > Something like this: > > > > select id,db,cr,(select sum(cr-db) from calc sub where sub.id <= > > calc.id) from calc; > > > > This of course assumes that ID indicates the correct order of the > > entries and it will blow up if you

Re: [SQL] Calc

2003-10-16 Thread Muhyiddin A.M Hayat
> Something like this: > > select id,db,cr,(select sum(cr-db) from calc sub where sub.id <= > calc.id) from calc; > > This of course assumes that ID indicates the correct order of the > entries and it will blow up if you allow nulls for cr or db (which > you shouldn't since that would literally be

Re: [SQL] Calc

2003-10-15 Thread Josh Berkus
There have been several discussions on running totals on this list over the last couple of weeks. See the archives for possible solutions. -- -Josh Berkus Aglio Database Solutions San Francisco ---(end of broadcast)--- TIP 1: subscribe and un

Re: [SQL] Calc

2003-10-15 Thread Steve Crawford
On Wednesday 15 October 2003 12:59 pm, Muhyiddin A.M Hayat wrote: > Dear all, > > I have below table > > +-++-+ > > | id |db|cr | > > +-++-+ > > |1 |