mirror of
https://github.com/sqlite/sqlite.git
synced 2025-07-29 08:01:23 +03:00
Add support for the TOTAL() aggregate function - works like SUM() except
that it returns 0 instead of NULL when presented with an empty list. (CVS 2930) FossilOrigin-Name: a7f528ff3446d50b280fb0b85063879e3ac5751a
This commit is contained in:
@ -102,6 +102,14 @@ do_test null-3.1 {
|
||||
}
|
||||
} {7 4 6 2 3 0.5 0.5 0 1}
|
||||
|
||||
# The sum of zero entries is a NULL, but the total of zero entries is 0.
|
||||
#
|
||||
do_test null-3.2 {
|
||||
execsql {
|
||||
SELECT sum(b), total(b) FROM t1 WHERE b<0
|
||||
}
|
||||
} {{} 0.0}
|
||||
|
||||
# Check to see how WHERE clauses handle NULL values. A NULL value
|
||||
# is the same as UNKNOWN. The WHERE clause should only select those
|
||||
# rows that are TRUE. FALSE and UNKNOWN rows are rejected.
|
||||
|
Reference in New Issue
Block a user