Re: [sqlite] group_concat(distinct) with empty strings

2014-05-07 Thread Richard Hipp
http://www.sqlite.org/src/info/0deac8737545a020d344be96fff16660a7977ab8
-- 
D. Richard Hipp
d...@sqlite.org
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] group_concat(distinct) with empty strings

2014-05-07 Thread Clemens Ladisch
Hinrichsen, John wrote:
> Are the results below expected?
> sqlite> SELECT (SELECT GROUP_CONCAT(DISTINCT COALESCE(a,'')) FROM z) IS NULL;
> 1

You don't need DISTINCT:

sqlite> select typeof(group_concat(''));
null

The documentation says:
| The group_concat() function returns a string which is the
| concatenation of all non-NULL values of X.

So this is a bug.

(AFAICS groupConcatStep() does not bother to do anything for empty
strings, so those are handled as if they had been NULL.)


Regards,
Clemens
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] group_concat(distinct) with empty strings

2014-05-06 Thread Hinrichsen, John
Are the results below expected?

$ sqlite3
SQLite version 3.8.4.3 2014-04-03 16:53:12
Enter ".help" for usage hints.
Connected to a transient in-memory database.
Use ".open FILENAME" to reopen on a persistent database.
sqlite> CREATE TABLE z AS SELECT NULL AS a;
sqlite> SELECT (SELECT DISTINCT COALESCE(a,'') FROM z) IS NULL;
0
sqlite> SELECT (SELECT GROUP_CONCAT(DISTINCT COALESCE(a,'')) FROM z) IS
NULL;
1
sqlite> SELECT (SELECT GROUP_CONCAT(DISTINCT COALESCE(a,' ')) FROM z) IS
NULL;
0
sqlite>

This problem looks similar to:
http://sqlite.1065341.n5.nabble.com/group-concat-and-empty-strings-td62226.html

-- 

This message contains confidential information and is intended only for the 
individual named. If you are not the named addressee, you should not 
disseminate, distribute, alter or copy this e-mail. Please notify the 
sender immediately by e-mail if you have received this e-mail by mistake 
and delete this e-mail from your system. E-mail transmissions cannot be 
guaranteed to be secure or without error as information could be 
intercepted, corrupted, lost, destroyed, or arrive late or incomplete. The 
sender, therefore, does not accept liability for any errors or omissions in 
the contents of this message which arise during or as a result of e-mail 
transmission. If verification is required, please request a hard-copy 
version. This message is provided for information purposes and should not 
be construed as a solicitation or offer to buy or sell any securities or 
related financial instruments in any jurisdiction.
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] group_concat + distinct

2010-09-22 Thread Jan
afaik "group_concat(distinct a, ',')" is not allowed. 
"group_concat(distinct a)" or "group_concat(a, ',')" do work. It is 
mentioned somewhere in the docs.

Jan

Am 22.09.2010 14:00, schrieb Wiktor Adamski:
> SQLite version 3.7.2
> Enter ".help" for instructions
> Enter SQL statements terminated with a ";"
> sqlite>  create table t(a);
> sqlite>  select group_concat(distinct a) from t;
>
> sqlite>  select group_concat(distinct a, ',') from t;
> Error: DISTINCT aggregates must have exactly one argument
>
> Both queries should return the same result.
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] group_concat + distinct

2010-09-22 Thread Wiktor Adamski
SQLite version 3.7.2
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> create table t(a);
sqlite> select group_concat(distinct a) from t;

sqlite> select group_concat(distinct a, ',') from t;
Error: DISTINCT aggregates must have exactly one argument

Both queries should return the same result.
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users