The following example demonstrates what seems to be a bug in group_concat.  
With the latest version of CVS:

CREATE TABLE example (id INTEGER, x TEXT);
CREATE TABLE table2 (key TEXT, x TEXT);
CREATE TABLE list (key TEXT, value TEXT);

INSERT INTO example VALUES (1, "a");
INSERT INTO table2 VALUES ("a", "alist");
INSERT INTO table2 VALUES ("b", "blist");
INSERT INTO list VALUES ("a", 1);
INSERT INTO list VALUES ("a", 2);
INSERT INTO list VALUES ("a", 3);
INSERT INTO list VALUES ("b", 4);
INSERT INTO list VALUES ("b", 5);
INSERT INTO list VALUES ("b", 6);

SELECT example.id,
       table2.x,
       (SELECT group_concat(list.value) FROM list WHERE list.key = table2.key)
FROM example, table2;

Output:
        
1|alist|1,2,3
1|blist|,4,5,6

I expected:

1|alist|1,2,3
1|blist|4,5,6


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

Reply via email to