db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rick Hillegas <Richard.Hille...@Sun.COM>
Subject Re: Derby Aggregate Function
Date Fri, 02 Nov 2007 12:43:31 GMT
Cloudscape (the codeline which Derby is based on) used to include 
user-defined aggregates, which you could declare with a CREATE AGGREGATE 
statement. DERBY-672 tracks the effort to put user-defined aggregates 
into Derby. It sounds as though you might want to volunteer for this 
effort. That would be great! I would start by searching the codeline for 

Hope this helps,

bushmonger wrote:
> I wish to create an aggregate function to comma delimit grouped-by results. 
> I need an example of a Sql Routine for SUM() or COUNT()... so I can create
> this "COMMADELIM" function.  MySQL, Oracle, SQLServer all provide ways to
> build this or come with this default.
> Here is an example data scenario:
> create table orders (
>   order_id   integer,
>   product    varchar(100)
> );
> insert into orders (order_id, product) values(1, 'Shoe');
> insert into orders (order_id, product) values(1, 'Boot');
> insert into orders (order_id, product) values(1, 'Sandal');
> select order_id, commadelim(product) products from orders group by order_id;
> This would produce the results:
> order_id          products
> -------------------------------------------------
> 1                    Shoe, Boot, Sandal
> Anyone have examples or ideas?

View raw message