有没有将varchar转换为double的函数? 

解决方案 »

  1.   

    直接 +0.0 就行了select '123.45' + 0.0;
      

  2.   

    当然也可以用 CONVERT(expr,type), CAST(expr AS type)  函数来实现。请参考一下官方手册。MySQL官方文档 http://dev.mysql.com/doc/refman/5.1/zh/index.html
      

  3.   

    mysql> select cast('123.58' as decimal(10,3));
    +---------------------------------+
    | cast('123.58' as decimal(10,3)) |
    +---------------------------------+
    |                         123.580 |
    +---------------------------------+
    1 row in set (0.00 sec)mysql>