SQLite Forum

Incorrect Result From SQLite Query
Login
The result query from the SQLite is incorrect.

Some data are not being calculate by the formula but the data are included in the result table.

There are 10 row data, but only 9 row data is calculate, the another 1 row data is not calculate.

select (amount * rate) as cost

from report_A

Example:

Raw data:
  | Amount | Rate
row 1 | 100 | 0.12
row 2 | 50 | 0.15
row 3 | 20 | 0.005
row 4 | 60 | 0.13
row 5 | 10 | 0.15
row 6 | 67 | 0.005
row 7 | 50 | 0.001
row 8 | 87 | 0.006
row 9 | 12 | 0.005
row 10 | 43 | 0.12

Result:

| Amount | Rate | Cost

row 1 | 100 | 0.12 | 12
row 2 | 50 | 0.15 | 7.5
row 3 | 20 | 0.005 | 0.1
row 4 | 60 | 0.13 | 7.8
row 5 | 10 | 0.15 | 1.5
row 6 | 67 | 0.005 | 0.335
row 7 | 50 | 0.001 | 0.05
row 8 | 87 | 0.006 | 0.522
row 9 | 12 | 0.005 | 0.06
row 10 | 43 | 0.12 | 0

Expected Result:

| Amount | Rate | Cost
row 1 | 100 | 0.12 | 12
row 2 | 50 | 0.15 | 7.5
row 3 | 20 | 0.005 | 0.1
row 4 | 60 | 0.13 | 7.8
row 5 | 10 | 0.15 | 1.5
row 6 | 67 | 0.005 | 0.335
row 7 | 50 | 0.001 | 0.05
row 8 | 87 | 0.006 | 0.522
row 9 | 12 | 0.005 | 0.06
row 10 | 43 | 0.12 | 5.16