On 10/7/2010 10:24 AM, Andy Seaborne wrote:
> > On 2010-10-07, at 02:50, Axel Polleres wrote:
> >
> >> When thinking about practical examples for GROUP_CONCAT, I can
> hardly think of any where I wouldn't want to impose an order...
> >> ... thus, what's the opinions about adding another scalar parameter
> "order" which takes as parameter "DESC"|"ASC"
> >>
>
> I agree that it makes GROUP_CONCAT rather more useful to be able to
> control the order.
>
> On 07/10/10 11:18, Steve Harris wrote:
>> My feeling is that you need ORDER BY expression to make it useful.
>
> Agreed.
I'll be a dissenting voice here -- we use GROUP_CONCAT all the time
without ordering, and I'm not totally clear what use cases are addressed
by ordering *based on the concatenated string values*. Could you help me
understand this?
(I see how useful it would be to be able to order the values based on
some other variable from the group in order to have consistent orderings
across multiple GROUP_CONCAT invocations within a project list, but
that's different from what I think I'm reading here...)
Lee
>
> Andy
>
>> On 2010-10-07, at 02:50, Axel Polleres wrote:
>>
>>> When thinking about practical examples for GROUP_CONCAT, I can hardly
>>> think of any where I wouldn't want to impose an order...
>>> ... thus, what's the opinions about adding another scalar parameter
>>> "order" which takes as parameter "DESC"|"ASC"
>>>
>>> That is, e.g. something like:
>>>
>>> PREFIX foaf:<http://xmlns.com/foaf/0.1/>
>>> SELECT ( SAMPLE(?N) as ?Name)
>>> ( GROUP_CONCAT(?M; SEPARATOR = ", " , ORDER="ASC") AS ?Nicknames )
>>> WHERE { ?P a foaf:Person ;
>>> foaf:name ?N ;
>>> foaf:nick ?M . }
>>> GROUP BY ?P
>>>
>>> It seems that GROUP_CONCAT in SQL dialects also has an ORDER BY
>>> clause, as e.g. a quick google search reveals for MySQL [1].
>>>
>>> Steve, do you think that would be a big deal to add?
>>> Others?
>>>
>>> Axel
>>>
>>> P.S.: I thought briefly about not only allowing "ASC"|"DESC" but an
>>> arbitrary ORDER BY expression, however, that admittedly seems not
>>> to go well with the current Aggregation() semantics definition, I am
>>> afraid...
>>>
>>>
>>> 1.
>>> http://dev.mysql.com/doc/refman/5.0/en/group-by-functions.html#function_group-concat
>>>
>>
>
>