我有一个数据集:
+----+---------------+-------+-------------+---------------------+
| id | ip | port | point_count | create_time |
+----+---------------+-------+-------------+---------------------+
| 1 | 192.168.20.28 | 10000 | 0 | 2013-03-29 14:29:14 |
| 2 | 0.0.0.0 | 10000 | 0 | 2013-03-29 14:29:32 |
| 3 | 0.0.0.1 | 11111 | 2 | 2013-03-29 14:29:38 |
| 4 | 0.0.0.5 | 11112 | 3 | 2013-03-29 14:29:44 |
+----+---------------+-------+-------------+---------------------+
4 rows in set (0.00 sec)
现在,我使用mysql的MIN()
函数来获取记录:
mysql> SELECT s.id, s.ip, s.port, MIN(s.point_count) FROM origin_server s;
+----+---------------+-------+--------------------+
| id | ip | port | MIN(s.point_count) |
+----+---------------+-------+--------------------+
| 1 | 192.168.20.28 | 10000 | 0 |
+----+---------------+-------+--------------------+
1 row in set (0.00 sec)
显然,列 point_count 有两行具有相同的值,但它只返回了一条记录。我只是想确认这种情况是否正确。提前致谢 :)