Dominique Devienne wrote:
> On Mon, Jan 12, 2015 at 4:13 PM, Igor Tandetnik <i...@tandetnik.org> wrote:
>> 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.
>
> OK, lets follow that logic:
> 1) a-comma yield just a (first row special case)
> 2) b-semi-colon yields semi-colon b
> 3) c-slash (both of them, collapsed by DISTINCT) yields slash c
> 4) c-colon yields colon c
> 5) d comma yields comma d
>
> so that's "a;b/c:c,d", not "a;b:c/c,d"

To remove duplicates efficiently, the database sorts the values, and the
colon happens to be sorted before the slash.


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

Reply via email to