Sqlite Rounding

748 views Asked by At
SUM(ROUND((price)-((price* TAX)/100 + purchaseprice),2)) as'"+PROFIT+"'

"PROFIT" without Rounding is 15.0057 and with it is 15 instead of 15.01

"TAX" is the percentage for example "19%" but stored without the "%" no problems there.

price and purchaseprice are stored as numeric.

What do i have to change to get 15.01 instead of 15. A better solution for me would be to format "PROFIT" somehow with NumberFormat currencyFormatter = NumberFormat.getCurrencyInstance();

1

There are 1 answers

1
sqlab On BEST ANSWER

You rounded probably prematurely. So

ROUND(SUM(price - (price* TAX/100) + purchaseprice),2)

should give the wanted result.