Comments - Getting Help With MariaDB

1 month ago Wim Roffel

In the selected fields of a query I had the following field statement:

ROUND(((od.price_incl-od.price_excl)*100/od.price_excl),1)) AS taxrate

That worked ok. I got values like "7.0" and "12.1".

The problem was that with small prices it is not accurate. So I had to add a clause that for small prices some other source will be used. So I got:

IF(od.price_excl < 1.0, rate, ROUND(((od.price_incl-od.price_excl)*100/od.price_excl),1))) AS taxrate

And now suddenly I get values like "7.000" and "12.100" returned when the ROUND statement is executed. There is still rounding taking place. However, two zeroes are added. Most likely this has something to do with the other option (rate) that contains values with three decimals like "1.000".

Is this a bug?

Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.