The easiest way is to simply add a zero!
Examples:
SET @yournumber1="1.0", @yournumber2="1.50", @yournumber3="10.030", @yournumber4="0.50", @yournumber5="0.0" ; SELECT (@yournumber1+0), (@yournumber2+0), (@yournumber3+0), (@yournumber4+0), (@yournumber5+0) ; +------------------+------------------+------------------+------------------+------------------+ | (@yournumber1+0) | (@yournumber2+0) | (@yournumber3+0) | (@yournumber4+0) | (@yournumber5+0) | +------------------+------------------+------------------+------------------+------------------+ | 1 | 1.5 | 10.03 | 0.5 | 0 | +------------------+------------------+------------------+------------------+------------------+ 1 row in set (0.00 sec)
If the column in which your value is used is of type DECIMAL or NUMERIC, then first produce it in a row to make sure that the conversion is ... ex:
SELECT (CAST(`column_name` AS CHAR)+0) FROM `table_name`;
For a shorter path, simply use any built-in string function to execute:
SELECT TRIM(`column_name`)+0 FROM `table_name`;
source share