SQLite Forum

More math help and what I've learned
Login
you could probably get rid of the case exceptions if you provide a value 0.0 instead of the NULL for the case where you need the other formulas. Both would work as expected when a value of 0.0 would substitute the NULL ... isn't it?

~~~
select null as V1, ifnull(NULL,0) as V2good, ifnull(3.14,0) as V3, 5-null as V4, 5-ifnull(null,0) as V5
~~~

would produce as output:

~~~
V1    V2good   V3     V4     V5
null  0        3.14   null   5
~~~

as you can see, with value 0 you would get the found value reduced by nothing (0.0) while the null would not (and did not) give you the expected results.

**ifnull** will also be your friend for future queries like **case** is already, I guess... have fun with SQL and SQLite3 !