List:General Discussion« Previous MessageNext Message »
From:Michael Farr Date:April 14 1999 10:05am
View as plain text  
I would like to query a table with two columns, 1st being just a key field,
second being a debit field (float) ie


service	|	debit
1		|	50
2		|	100
3		|	-30

I would like to query the table with a select and get back a balance field
calculated at run time as well ie

select debit, balance()
from account

debit		|	debit
50		|	50
100		|	150
-30		|	120

Is this possible in MySQL?  I read that I may be able to say create
function balance() to create that function, but I don't know how to do that!

Any ideas would be muchly appreciated.


balancesMichael Farr14 Apr
  • Re: balancesColin McKinnon14 Apr
  • Re: balancesChristian Mack14 Apr
  • balancesMichael Widenius15 Apr