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
> 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.
I think you search for UDF (User Defined Functions).
There are some examples in the source distrib.