Please help me. I have division problem on mysql. I have query like this :
SELECT (8/10) as res
This query result is 0.8000 and I want the result is 0.8 not 0.8000. Does someone have a solution?
Please help me. I have division problem on mysql. I have query like this :
SELECT (8/10) as res
This query result is 0.8000 and I want the result is 0.8 not 0.8000. Does someone have a solution?
You are not very clear but I think the following queries does what you want:
SELECT TRIM(TRAILING '0' FROM ( 80/100 )) as res;
# Output is 0.8
SELECT TRIM(TRAILING '0' FROM ( 15/100 )) as res;
# Output is 0.15
It will remove the trailing 0 from the result.
If you do for example:
SELECT TRIM(TRAILING '0' FROM ( 81/11 )) as res;
# Output is 7.3636
So the question is what exactly do you want to do? Do you need rounding at all?
EDIT :Trim with add 0 value
SELECT TRIM((80/100))+0