Actually, every database I'm aware of returns NULL for any aggregate
whenever the inputs are NULL, and also when no input rows are processed
(i.e. if no rows match the criteria in the WHERE clause, the result of
the aggregation is NULL).

   -Tom

> -----Original Message-----
> From: Will Leshner [mailto:[EMAIL PROTECTED] 
> Sent: Thursday, September 08, 2005 2:51 PM
> To: sqlite-users@sqlite.org
> Subject: Re: [sqlite] SUM and NULL values
> 
> 
> On Sep 8, 2005, at 11:33 AM, D. Richard Hipp wrote:
> 
> > SUM ignores NULLs.  So if it ignores everything, it returns the
> > sum of nothing, which is 0.  (Not the 0.0 issue is fixed in 
> CVS HEAD.)
> 
> As a data point, MySQL returns NULL for a SUM over fields that are  
> all NULL. I am not suggesting, of course, that SQLite should imitate  
> MySQL.
> 

Reply via email to