drop table if exists orders_tbl; create table if not exists orders_tbl(ord_total,discount,tax1,tax2,tax3,tax4,delivery_tax,delivery_fee,subtotal); insert into orders_tbl values(38.55, 0, 2.42, 0, 0, 0, .1, 1.5, 34.53); insert into orders_tbl values(3855, 0, 242, 0, 0, 0, 10, 150, 3453);
select *,'(rounding error)' from orders_tbl where (ord_total+discount-tax1-tax2-tax3-tax4-delivery_tax-delivery_fee)!=subtotal; select *, '(used round)' from orders_tbl where round(ord_total+discount-tax1-tax2-tax3-tax4-delivery_tax-delivery_fee,2)=subtotal; select *, '(multiple results by .01)' from orders_tbl where (ord_total+discount-tax1-tax2-tax3-tax4-delivery_tax-delivery_fee)=subtotal; result: -------------------------------------------------- 38.55 0 2.42 0 0 0 0.1 1.5 34.53 (rounding error) -------------------------------------------------- 38.55 0 2.42 0 0 0 0.1 1.5 34.53 (used round) 3855 0 242 0 0 0 10 150 3453 (used round) -------------------------------------------------- 3855 0 242 0 0 0 10 150 3453 (multiple results by .01) -- View this message in context: http://sqlite.1065341.n5.nabble.com/SELECT-statement-failure-tp72814p72837.html Sent from the SQLite mailing list archive at Nabble.com. _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users