Hello,
On 2018-01-02 22:39, Scott Robison wrote:
On Tue, Jan 2, 2018 at 1:36 PM, Tony Papadimitriou <to...@acm.org> wrote:
create table t(s);
insert into t values ('A'),('A'),('B');
select group_concat(s,', ') from t group by null; -- OK
select group_concat(distinct s) from t group by null; -- OK
select group_concat(distinct s,', ') from t group by null; -- ERROR
-- The moment the optional delimiter is given along with DISTINCT you get this
error:
-- Error: near line 6: DISTINCT aggregates must have exactly one argument
A limitation of the SQL syntax.
Quite justly, not all the time params are obvious -- group functions are
not group functions with 1 column and n one-bind-time parameters:
sqlite> CREATE TABLE a(a,sep);
sqlite> INSERT INTO a VALUES('Hello', ','),('world', ';'),('shmorld', '
AND ');
sqlite> SELECT group_concat(a,sep) FROM a GROUP BY NULL;
Hello;world AND shmorld
Hopefully, SELECT FROM SELECT DISTINCT mentioned previously by Scott,
resolves the problem in an easy & painless way.
-- best regards
Cezary H. Noweta
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users