Re: Column aggregating for text columns

From: Sirin Venigalla <a_at_abc.com>
Date: Sat, 25 May 2002 01:26:24 GMT
Message-ID: <4LBH8.12896$xN5.3167642_at_typhoon.nyroc.rr.com>


> Quite clever way to solve it. However, if one could define aggregate
> functions the solution would have been slightly less complicated :-)
> I'm thinking something like:
>
> select id, my_concat(name) from test group by id

It works for me. I may be dumb (Joe Celko thinks so, atleast), but I believe a row aggregate function for summing and multiplying (PRODUCT) should have been included long ago in the SQL standard.

The one modification I would do to your suggestion is adding the maxlength or precision as a parameter to the aggregating function. something like -

concat (name, 300) or
product (salary, 15.2)

>
> I raised the question some time ago, and Kieran mentioned that
> Informix and Postgres have an CREATE AGGREGATE command for this. There
> is also a discussion about how to calculate PRODUCT (which also is
> fairly complicated to express without an aggregate function) in there.
> If you use google you can find the thread by searching for
> lennart_at_kommunicera.umea.se and "user defined column functions"

That would work too, but it leaves the programmers at the mercy of the vendors, as each vendor would foist their own syntax/language as is the case for the stored procedures.

I read the thread you have suggested. Thanks. Received on Sat May 25 2002 - 03:26:24 CEST

Original text of this message