SQLite Forum

Missing records from the IN list
Login
Also note that you can use TOTAL(...) rather than COALESE(SUM(...),0).

TOTAL is the same as sum except that it always returns a double with a default value of 0.0.