This will cause a rounding error so using INTEGER * .01 in second example.

USING REAL:
DROP TABLE IF EXISTS T1;
CREATE TABLE IF NOT EXISTS T1(F1,F2,F3,F4,SUBTOTAL);
INSERT INTO ORDERS_TBL VALUES(38.55,0,2.42,0,0,0,.1,1.5,34.53)
SELECT * FROM orders_tbl WHERE ROUND(F1-F2-F3-F4,2)=SUBTOTAL;

Using INTEGER:
DROP TABLE IF EXISTS T1;
CREATE TABLE IF NOT EXISTS T1(F1,F2,F3,F4,SUBTOTAL);
INSERT INTO T1 VALUES(3855,242,10,150,3453);
SELECT * FROM T1 WHERE F1-F2-F3-F4 = SUBTOTAL;


This brings up the internal representation of a decimal on either side of an
equal sign.
IF  X = Y
Does this mean it is necessary to use IF ROUND(X,2) = ROUND(Y,2)?

IF A = B + C
Should this use:
IF ROUND(A,2) = ROUND(A+B)
or
IF ROUND(A,2) = ROUND(A,2) + ROUND(B,2)?

The simple solution is use INTEGER and multiple by .01, but
extremely interested in how to correctly process money with 2 decimal
positions.

Thank you,
Mike






--
View this message in context: 
http://sqlite.1065341.n5.nabble.com/SELECT-statement-failure-tp72814p72828.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

Reply via email to