On 30 Nov 2016, at 10:43pm, Keith Medcalf <kmedc...@dessus.com> wrote:
>> You were given a good recommendation save everything in "cents". Which >> might also be a good solution depending on the underlying language you >> use. as you can't store money in a float! > > And why can you not store money in a float? Because this: SQLite version 3.14.0 2016-07-26 15:17:14 Enter ".help" for usage hints. sqlite> CREATE TABLE transactions (amount REAL); sqlite> INSERT INTO transactions VALUES (0.1),(0.1),(0.1); sqlite> INSERT INTO transactions VALUES (-0.3); sqlite> SELECT CASE WHEN (SELECT sum(amount) FROM transactions) = 0 THEN 'zero' ELSE 'not zero' END; not zero sqlite> SELECT sum(amount) FROM transactions; 5.55111512312578e-17 sqlite> Please note that this is not just a problem with SQLite. One can demonstrate the equivalent problem in many programming languages and databases. Simon. _______________________________________________ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users