Mysql: How to get every rows that have more than a certain number of decimal after the dot

前端 未结 6 718
天命终不由人
天命终不由人 2020-12-19 17:12

I have a table that contains float values.

table

+   id   |  value  |
+--------|---------|
+   1    | 19.22   |
+   2    | 32.333  |
+   3    | 1.         


        
6条回答
  •  有刺的猬
    2020-12-19 17:42

    This worked for me:

    SELECT  *
    FROM table
    WHERE column <> ROUND (column,2)
    

    or:

    SELECT  *
    FROM table
    WHERE column <> CAST (column AS DECIMAL(36,2))
    

提交回复
热议问题