Dominique Devienne, on Friday, November 15, 2019 09:02 AM, wrote...
>
> As can be seen below, the last query fail, despite the one before it
> succeeding.
> Yet the second argument is constant, thus it would seem "natural" for it to
> work as well.
> Could the error be "relaxed", when the non-first argument(s) to aggregate
> functions are constant?
>
> Thanks, --DD
>
> C:\Users\ddevienne>sqlite3
> SQLite version 3.28.0 2019-04-16 19:49:53
> Enter ".help" for usage hints.
> Connected to a transient in-memory database.
> Use ".open FILENAME" to reopen on a persistent database.
> sqlite> create table t (id int);
> sqlite> insert into t values (1), (2), (4), (2), (1), (7);
> sqlite> select count(distinct id) from t;
> 4
> sqlite> select group_concat(distinct id) from t;
> 1,2,4,7
> sqlite> select group_concat(distinct id, ', ') from t;
> Error: DISTINCT aggregates must have exactly one argument

Have you tried this,
sqlite> select group_concat(distinct id || ', ') from t;
1, ,2, ,4, ,7,
sqlite>

The only problem is that when the list has a non-distinct.  Hmmmm.

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

Reply via email to