I have a table with products that have columns like this: price[decimals 8,5] and decimals [tinyint – max value is 5].
When I list products must show price according to the decimals specified in decimals column.
I tried something like this(with mysql)
select p.price, round(p.price, p.decimals) as price, p.decimals
from product p
but it returns
100.35667 100.35700 3
and i would like to be 100.
I also see that ‘Round’ rounds the number which is not my scope.
Regards.
You need the
FORMATfunction:http://dev.mysql.com/doc/refman/5.0/en/string-functions.html#function_format