Feature Requests item #2175942, was opened at 2008-10-18 05:37
Message generated for change (Comment added) made by mr-meltdown
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=482471&aid=2175942&group_id=56967

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: SQL - general
Group: None
Status: Open
Priority: 1
Private: No
Submitted By: Stefan de Konink (skinkie)
Assigned to: Nobody/Anonymous (nobody)
>Summary: SQL: string aggregate function (group_concat)

Initial Comment:
It would be a really nice addiction to the 'helpful examples' base if some 
examples could be added with respect to the processing of functions. I took a 
peak in the sql test directory but non of the examples really fits the bill.

What I want is an equivalent of the 
http://dev.mysql.com/doc/refman/5.0/en/group-by-functions.html#function_group-concat
 MySQL function, or STRAGG in Orace.

The use case is on the fly GIS creation polyline creation.
SELECT '(' || x || ',' || y || ')' INTO out FROM way_nds, nodes_legacy WHERE 
thisway = way AND nodes_legacy.id = to_node;

Would select a list of (x,y) that can be concatted to polyline((..), (..)) this 
would allow for example OGR/MapServer to make use of my dataset directly 
without going the way of making a hybride dataset that stores the POLYLINE(...) 
in my way column. Quick and dirty solutions are willingly accepted.


----------------------------------------------------------------------

>Comment By: Fabian (mr-meltdown)
Date: 2009-12-01 10:27

Message:
I don't see how this would be a MonetDB request, if it seems that this
should be handled in the application layer.

----------------------------------------------------------------------

Comment By: Stefan de Konink (skinkie)
Date: 2008-10-19 05:10

Message:
Application layer solution suffices for now.

----------------------------------------------------------------------

Comment By: Stefan de Konink (skinkie)
Date: 2008-10-18 06:05

Message:
I'll just make it easyer...

CREATE AGGREGATE group_concat (
        BASETYPE = text,
        SFUNC = _group_concat,
        STYPE = text
);

How to get the above running inside Monet?
Below is what already works:

CREATE FUNCTION _group_concat(input1 text, input2 text)
RETURNS text
BEGIN
RETURN SELECT CASE
WHEN input2 IS NULL THEN input1
WHEN input1 IS NULL THEN input2
ELSE input1 || ',' || input2
END;
END;




----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=482471&aid=2175942&group_id=56967

------------------------------------------------------------------------------
Join us December 9, 2009 for the Red Hat Virtual Experience,
a free event focused on virtualization and cloud computing. 
Attend in-depth sessions from your desk. Your couch. Anywhere.
http://p.sf.net/sfu/redhat-sfdev2dev
_______________________________________________
Monetdb-bugs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-bugs

Reply via email to