On Thu, 2005-09-08 at 16:43 -0400, Thomas Briggs wrote:
>  
> > Can somebody come up with a realistic scenario where they would
> > actually want SUM() to return NULL instead of 0?  
> 
>    I think your example of totaling sales in October makes the argument
> itself - you didn't make sales totaling $0 in October, you just didn't
> make any sales.  A subtle but irritatingly big difference. :)
> 

No.  The question I asked was what was the total value of
all sales in October.  That answer is 0.  If I had wanted to
know whether or not there were any sales in October I would
have used COUNT instead of SUM.

By your argument, the official meaning of SUM in SQL is some
strange and not particularly useful comingling of the
concepts of magnitude (sum) and cardinality (count).  It
seems much more useful to keep these concepts distinct and
in separate functions, which is what I am proposing to do
in SQLite in defiance of the SQL standard.
-- 
D. Richard Hipp <[EMAIL PROTECTED]>

Reply via email to