His balance is a running balance...

Joseph, you will have to keep the running balance in some thing
that you write to get the query.. you can't do a running sum
in SQL directly. You can only use the examples people provided
to get the net per line.



Joseph Bueno wrote:
> 
> [EMAIL PROTECTED] a écrit :
> >
> > Dear all,
> > Sorry to ask question again, or maybe i am just a beginner.
> >
> > I wanna ask:
> > If there are 2 records
> > Name             Income      Out
> > Data1               1000       700
> > Data2                970        500
> >
> > If i want to have the output:
> > Name              Income      Out      Balance
> > Data1               1000          700       300
> > Data2                970           500        770
> >
> > How to do that?
> > Thx!!!!!!!!
> >
> > Yours sincerely,
> > Jason Chan
> 
> Hi,
> 
> Have you tried
> select income,out,income-out as balance from <table> ?
> 
> Assuming 770=970-500 (strange math isn't it ;)
> 
> Regards
> --
> Joseph Bueno
> NetClub/Trader.com
> 
> ---------------------------------------------------------------------
> Before posting, please check:
>    http://www.mysql.com/manual.php   (the manual)
>    http://lists.mysql.com/           (the list archive)
> 
> To request this thread, e-mail <[EMAIL PROTECTED]>
> To unsubscribe, e-mail <[EMAIL PROTECTED]>
> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to