SQLite Forum

Incorrect Result From SQLite Query
Login
I executed this DDL to begin reproducing your incorrect result:<code>
 CREATE TABLE report_A (row INTEGER, amount INTEGER, rate REAL);
</code>

Then I used your so-called raw data to create, then execute this DML:<code>
 INSERT INTO report_A VALUES(1,100,0.120);
 INSERT INTO report_A VALUES(2,50,0.150);
 INSERT INTO report_A VALUES(3,20,0.005);
 INSERT INTO report_A VALUES(4,60,0.130);
 INSERT INTO report_A VALUES(5,10,0.150);
 INSERT INTO report_A VALUES(6,67,0.005);
 INSERT INTO report_A VALUES(7,50,0.001);
 INSERT INTO report_A VALUES(8,87,0.006);
 INSERT INTO report_A VALUES(9,12,0.005);
 INSERT INTO report_A VALUES(10,43,0.120);
</code>

Then, upon executing this query,<code>
 SELECT row, (amount*rate) as cost FROM report_A;
</code>, I see this result set:<code>
1|12.0
2|7.5
3|0.1
4|7.8
5|1.5
6|0.335
7|0.05
8|0.522
9|0.06
10|5.16
</code>

To me, it looks like the correct result. I get the same result with all versions of the SQLite CLI that I have tried. So you must be doing something different. What would that be? I suspect that difference is important.