On Thu, 2005-09-08 at 14:12 -0700, Robert Simpson wrote:

> If SUM returns 0 when no rows were evaluated, then SQLite is making an 
> assumption about what the answer should be, which is incorrect.
> 
> SELECT SUM(temperature) FROM antartica WHERE temperature < -150 LIMIT 1
> 
> Does it makes sense for that query to return 0 if no rows matched the 
> criteria?  

Temperature is an intensive property, not an extensive property, and
is therefore not additive.  SUM(temperature) not a sensible thing to
do.  The correct query should omit the SUM like this:

   SELECT temperature FROM antartica WHERE temperature < -150 LIMIT 1

Which gives the result you seek.

Thank you for the suggestion, though...
-- 
D. Richard Hipp <[EMAIL PROTECTED]>

Reply via email to