Subject | Re: [firebird-support] Aggregate UDFs? |
---|---|
Author | Kjell Rilbe |
Post date | 2006-04-20T13:30:58Z |
Alan McDonald wrote:
that.
But that's not the point. Forget the example. Imagine, if you can, that
you would need to do some kind of aggregate calculation that can't be
done using any of the built-in aggregate functions. Could I write my own
UDF to do it? (Adam already answered "no" btw.)
Let's try with a different example: you have a table of numbers and you
need to calculate the least common denominator (LCD):
select LCD_UDF(NUMBER)
from NUMBERS
Kjell
--
--------------------------------------
Kjell Rilbe
Adressmarknaden AM AB
E-post: kjell.rilbe@...
Telefon: 08-761 06 55
Mobil: 0733-44 24 64
>>Alan McDonald wrote:So sum(...) can actually concatenate char/varchar columns? I didn't know
>>
>>>>This is not something I need right now, but I'm curious: is it possible
>>>>to add aggregate functions as UDFs?
>>>>
>>>>If not, are there any plans to add support for this?
>>>
>>>Do you mean SUM(), AVG() etc? if so then they are already
>>>internal to the engine.
>>
>>Yes, I mean that KIND of function, but assume you'd want to return for
>>example a concatenation of the values in a column:
>>
>>select Concat_UDF(ITEM)
>>from STUFF
>>group by CATEGORY
>
> select CATEGORY, sum(FIELDNAME) from TABLENAME group by CATEGORY
>
> If that's what you want then use it - it's there for you to use
that.
But that's not the point. Forget the example. Imagine, if you can, that
you would need to do some kind of aggregate calculation that can't be
done using any of the built-in aggregate functions. Could I write my own
UDF to do it? (Adam already answered "no" btw.)
Let's try with a different example: you have a table of numbers and you
need to calculate the least common denominator (LCD):
select LCD_UDF(NUMBER)
from NUMBERS
Kjell
--
--------------------------------------
Kjell Rilbe
Adressmarknaden AM AB
E-post: kjell.rilbe@...
Telefon: 08-761 06 55
Mobil: 0733-44 24 64