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

前端 未结 6 769
天命终不由人
天命终不由人 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:57

    This worked for me

    SELECT * 
    FROM `table` 
    WHERE LENGTH(SUBSTR(`value`,INSTR(`value`,"."))) >3
    

    Counting the decimal .01 is 3, .011 is 4

提交回复
热议问题