[sqlite] 'order by' doesn't work with 'group_concat()'

2016-01-05 Thread Simon Davies
On 5 January 2016 at 00:14, Yuri wrote: > Please consider this example: . . . > The 'order by' clause doesn't work, because if it did the result would have > been: > 1|x,y > 2|x,y > > sqlite3-3.9.2 > > Yuri See http://www.sqlite.org/lang_aggfunc.html last sentence " group_concat(X)

[sqlite] 'order by' doesn't work with 'group_concat()'

2016-01-05 Thread Keith Medcalf
NB: This format of the select only works co-incidentally. Presently, the SQLite query planner "believes" that the order by is significant to the result and preserves it at some expense. This may not always be the case. Thus using this method to obtain the desired result is relying on an

[sqlite] 'order by' doesn't work with 'group_concat()'

2016-01-05 Thread Keith Medcalf
ists.sqlite.org [mailto:sqlite-users- > bounces at mailinglists.sqlite.org] On Behalf Of Yuri > Sent: Monday, 4 January, 2016 17:14 > To: General Discussion of SQLite Database > Subject: [sqlite] 'order by' doesn't work with 'group_concat()' > > Please consider this example: >

[sqlite] 'order by' doesn't work with 'group_concat()'

2016-01-04 Thread Yuri
Please consider this example: ---begin--- #!/bin/sh DB=sq.sqlite rm -f $DB sql() { echo "$1" | sqlite3 $DB } sql "create table a(id integer not null, primary key(id));" sql "create table b(oid integer not null, chr char null);" sql "insert into a values(1);" sql "insert into a values(2);"