List:General Discussion« Previous MessageNext Message »
From:Christian Mack Date:April 14 1999 7:31pm
Subject:Re: balances
View as plain text  
Michael Farr wrote:
> 
> I would like to query a table with two columns, 1st being just a key field,
> second being a debit field (float) ie
> 
> account:
> 
> 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.
> 
> Thanks
> Mike

Hi Mike

I think you search for UDF (User Defined Functions).
There are some examples in the source distrib.

Tschau
Christian

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