1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-01 06:27:03 +03:00

A SUM() of all NULLs returns NULL. A SUM() of nothing return 0.

A SUM() of a mixture of NULLs and numbers returns the sum of the
numbers.  Ticket #1413. (CVS 2677)

FossilOrigin-Name: 2e6230edfd651b40481ebad8aa01a22ac92ce80c
This commit is contained in:
drh
2005-09-08 19:45:57 +00:00
parent 825c662e66
commit 3f219f46fc
5 changed files with 46 additions and 18 deletions

View File

@ -13,7 +13,7 @@
# aggregate min() and max() functions and which are handled as
# as a special case.
#
# $Id: minmax.test,v 1.17 2005/09/08 10:37:01 drh Exp $
# $Id: minmax.test,v 1.18 2005/09/08 19:45:58 drh Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
@ -143,7 +143,7 @@ ifcapable {compound && subquery} {
} {1 20}
do_test minmax-4.2 {
execsql {
SELECT y, sum(x) FROM
SELECT y, coalesce(sum(x),0) FROM
(SELECT null, y+1 FROM t1 UNION SELECT * FROM t1)
GROUP BY y ORDER BY y;
}