告诉我这两个零是否有意义:
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 |
+------+----------+
有一种解决方法(转换为十进制(10,1)),但我很好奇 round() 是否损坏。我正在使用 MySQL 5.1