sql - How can I delete extra zero in a number in mysql? -
for example,i input number,it input format number.
if input 0010,it return 10; if input 0.0200,it return 0.02; if input 0.10,it return 0.1;
i try use code,but not work.can defined function or stored procedure encapsulate business functionality?
select rtrim(00.40)
trim() + 0
can trick:
select trim(0010)+0, trim(0.0200)+0, trim(0.10)+0 dual
output:
+--------------+----------------+--------------+ | trim(0010)+0 | trim(0.0200)+0 | trim(0.10)+0 | +--------------+----------------+--------------+ | 10 | 0.02 | 0.1 | +--------------+----------------+--------------+ 1 row in set
Comments
Post a Comment