mysql float data not selecting in where clause

后端 未结 5 1650
清酒与你
清酒与你 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:28

    Use decimal instead of float.

    A decimal(10,2) will have 2 and only 2 decimal places and can be compared in the same manner as integers. Especially for monetairy values you should always use decimal, but anywhere where rounding errors are unwanted, decimal is a good choice.

    See: http://dev.mysql.com/doc/refman/5.1/en/precision-math-decimal-changes.html

    Or MySQL DECIMAL Data Type Characteristics

提交回复
热议问题