Luigi <lu...@emme4.it> wrote:
> CREATE TABLE t1 (A1 INTEGER NOT NULL,A2 INTEGER NOT NULL,A3 INTEGER NOT
> NULL,A4 INTEGER NOT NULL,PRIMARY KEY(A1));
> REPLACE INTO t1 VALUES(1,11,111,1111);
> REPLACE INTO t1 VALUES(2,22,222,2222);
> REPLACE INTO t1 VALUES(3,33,333,3333);
> CREATE TABLE t2 (B1 INTEGER NOT NULL,B2 INTEGER NOT NULL,B3 INTEGER NOT
> NULL,B4 INTEGER NOT NULL,PRIMARY KEY(B1));
> REPLACE INTO t2 VALUES(1,88,888,8888);
> REPLACE INTO t2 VALUES(2,99,999,9999);
> 
> SELECT (SELECT GROUP_CONCAT(CASE WHEN a1=1 THEN'A' ELSE 'B' END) FROM t2),t1.*
> FROM t1;
> 
> from Sqlite 3.7.12
> return error misuse of aggregate

Looks like a bug. The query seems OK to me, formally.

However, practically speaking, it doesn't make much sense. What are you trying 
to achieve here? As far as I can tell, the query says: for every row in t1, 
generate a string consisting of as many 'A's or 'B's as there are rows in table 
t2. Why would you want such a thing?
-- 
Igor Tandetnik

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

Reply via email to