xref: /sqlite-3.40.0/test/aggnested.test (revision 030796df)
1# 2012 August 23
2#
3# The author disclaims copyright to this source code.  In place of
4# a legal notice, here is a blessing:
5#
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.
9#
10#***********************************************************************
11# This file implements regression tests for SQLite library.
12#
13# This file implements tests for processing aggregate queries with
14# subqueries in which the subqueries hold the aggregate functions
15# or in which the subqueries are themselves aggregate queries
16#
17
18set testdir [file dirname $argv0]
19source $testdir/tester.tcl
20
21do_test aggnested-1.1 {
22  db eval {
23    CREATE TABLE t1(a1 INTEGER);
24    INSERT INTO t1 VALUES(1), (2), (3);
25    CREATE TABLE t2(b1 INTEGER);
26    INSERT INTO t2 VALUES(4), (5);
27    SELECT (SELECT group_concat(a1,'x') FROM t2) FROM t1;
28  }
29} {1x2x3}
30do_test aggnested-1.2 {
31  db eval {
32    SELECT
33     (SELECT group_concat(a1,'x') || '-' || group_concat(b1,'y') FROM t2)
34    FROM t1;
35  }
36} {1x2x3-4y5}
37
38finish_test
39