Incorrect Sum on decimal column
Posted: Tue 28 May 2019 15:11
Hello,
I have trouble with the result of a SUM command. In my table, a decimal field is set at 18.2.
The values in the table are
price | obj
--------------
400 | flowers
120.50 | cars
77.77 | wheels
My querry is 'select SUM (price) as totalprice, obj from table group by price, obj'. If the first value has no decimal places, as in the example, the DotConnect universal adapter provides values without digits:
price | obj
----------
400 | flowers
120 | cars
77 | wheels
But: is the first value with digits, so for example 400.12 than returns the querry
price | obj
-------------
400.12 | flowers
120.50 | cars
77.77 | wheels
What happens here? But in SQLiteStudio I always get the correct result, regardless of the first digit.
Any idea?
Thanks for help.
I have trouble with the result of a SUM command. In my table, a decimal field is set at 18.2.
The values in the table are
price | obj
--------------
400 | flowers
120.50 | cars
77.77 | wheels
My querry is 'select SUM (price) as totalprice, obj from table group by price, obj'. If the first value has no decimal places, as in the example, the DotConnect universal adapter provides values without digits:
price | obj
----------
400 | flowers
120 | cars
77 | wheels
But: is the first value with digits, so for example 400.12 than returns the querry
price | obj
-------------
400.12 | flowers
120.50 | cars
77.77 | wheels
What happens here? But in SQLiteStudio I always get the correct result, regardless of the first digit.
Any idea?
Thanks for help.