mysql float data not selecting in where clause

后端 未结 5 1652
清酒与你
清酒与你 2020-12-16 20:18

This maybe an easy one but i couldn\'t get answer. I need to select float value from table

example table :-

value
10.2
4.5
4.6
4.06
<
5条回答
  •  情书的邮戳
    2020-12-16 20:44

    Today, I also came across the same situation and get resolved just by using FORMAT function of MySQL, It will return the results that exactly match your WHERE clause.

    SELECT * FROM yourtable WHERE FORMAT(`col`,2) = FORMAT(value,2)
    

    Explanation:

    FORMAT('col name',precision of floating point number)
    

    Hope it helps.

提交回复
热议问题