MySQL “greater than” condition sometimes returns row with equal value

前端 未结 3 851
夕颜
夕颜 2020-12-20 18:10

I\'m running into a baffling issue with a basic MySQL query.

This is my table:

id | rating
1  | 1317.17
2  | 1280.59
3  | 995.12
4  | 973.88
<         


        
3条回答
  •  南方客
    南方客 (楼主)
    2020-12-20 19:06

    You do not need the single quotes when you're comparing numbers.

    Take the single quotes off and try again.

    However, this has been noted as something you can solve with ROUND(SUM(column), 2) * 1

    if the single quotes don't work, compare it to the value of this ^^

    See link: https://dev.mysql.com/doc/refman/5.0/en/problems-with-float.html

提交回复
热议问题