SQLite subquery math returns wrong values SQLite subquery math returns wrong values sqlite sqlite

SQLite subquery math returns wrong values


Ah the key! Casting the numerator as FLOAT and now it works. Thanks.

SELECT state, ROUND((CAST(count(call) AS FLOAT)/(Select count(call) FROM test) * 100.00), 2) AS StatePctFROM testWHERE state IS NOT NULLGROUP BY stateORDER BY state ASC;