我用的版本是 server version: 5.0.18-standard-log
 出现的问题是在数据库中存在一条数据 weight=1.20 的数据(浮点型)
但是怎么都用等值查寻查不出来 select * from table where weight=1.20
崩溃 同事说是mysql版本问题 真郁闷。

解决方案 »

  1.   

    确认是浮点型吗?select * from table where weight>1.19 and weight<1.21 这样是什么结果?
      

  2.   

    這樣是有數據的 顯示的是 |   1.20 | 可是我是要用程序進行等值查詢不知道有什麼辦法嗎?
    查詢的sql是這樣的    sql="select * from table where weight=$wgt "
      

  3.   

    sql='select * from table where weight='+$wgt
      

  4.   

    sql='select * from table where cast(weight as DECIMAL(8,2))=+$wgt
      

  5.   

    你的那个字段是什么类型的?
    double or float or decimal?
      

  6.   

    這樣不行!  答5樓
    是float