On 1/12/2015 9:53 AM, Dominique Devienne wrote:
My little brain has no idea how the "a;b:c/c,d" came about from the input
rows, so I don't find it logical at all myself...

Simple, really. For each ('x', '@') row, string_agg adds '@x' to the resulting string (except the separator is omitted for the very first row encountered, in this case ('a', ',') ). Thanks to DISTINCT, the second occurrence of ('c', '/') is skipped , so you only have '/c' appear once. On the other hand, both '/c' and ':c' appear, indicating that DISTINCT works on both parameters, not just the first.

But I fail to see how the delimiter come from in "a;b:c/c,d", especially
why they are "out of order" vs the value-order. FWIW. --DD

Aggregate functions don't guarantee any particular order of visiting rows within the group. What is this "value-order" of which you speak? I'm not familiar with the term.

_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to