3 # The author disclaims copyright to this source code. In place of
4 # a legal notice, here is a blessing:
6 # May you do good and not evil.
7 # May you find forgiveness for yourself and forgive others.
8 # May you share freely, never taking more than you give.
10 #***********************************************************************
14 # Queries of the form:
16 # SELECT group_concat(x) FROM (SELECT * FROM table ORDER BY 1);
18 # The ORDER BY would be dropped by the query flattener. This used
19 # to not matter because aggregate functions sum(), min(), max(), avg(),
20 # and so forth give the same result regardless of the order of inputs.
21 # But with the addition of the group_concat() function, suddenly the
24 # $Id: tkt2942.test,v 1.1 2008/02/15 14:33:04 drh Exp $
27 set testdir [file dirname $argv0]
28 source $testdir/tester.tcl
37 create table t1(num int);
38 insert into t1 values (2);
39 insert into t1 values (1);
40 insert into t1 values (3);
41 insert into t1 values (4);
42 SELECT group_concat(num) FROM (SELECT num FROM t1 ORDER BY num DESC);
47 SELECT group_concat(num) FROM (SELECT num FROM t1 ORDER BY num);
52 SELECT group_concat(num) FROM (SELECT num FROM t1);
57 SELECT group_concat(num) FROM (SELECT num FROM t1 ORDER BY rowid DESC);