|
|
|
|
|
by gigatexal
2080 days ago
|
|
Here’s a Redshift oddity that I don’t think is documented: select sum(y.a), count(y.a) from(select distinct x.a from ( select 1 as a union all select 2 as a union all select 1 as a)x)y sum | count
-----+-------
4 | 3 Sqlite3 returns the correct results of sum of 3 count of 2. To fix this don’t use subqueries. |
|
https://dbfiddle.uk/?rdbms=postgres_12&fiddle=dc4ce40bd52695...