告诉我这两个零是否有意义:
select x, count(1) from (select round(rand()-0.5,1) x from tab) t group by x;
+------+----------+
| x | count(1) |
+------+----------+
| -0.5 | 1830 |
| -0.4 | 3726 |
| -0.3 | 3753 |
| -0.2 | 3835 |
| -0.1 | 3828 |
| 0.0 | 1909 |
| -0.0 | 1889 |
| 0.1 | 3831 |
| 0.2 | 3753 |
| 0.3 | 3793 |
| 0.4 | 3690 |
| 0.5 | 1887 |
+------+----------+
有一种解决方法(将其转换为decimal(10,1)),但我很好奇round()是否出了问题。我正在使用MySQL 5.1。