+----------------------------------+-------+---------------------+------+
| id | model | dates | who |
+----------------------------------+-------+---------------------+------+
| DB86A82A4D43AE94330F599281FF0A37 | 11111 | 2017-11-11 20:56:35 | A1 |
| F2B8467F36A00F7760BF142A6493EE71 | 11111 | 2017-11-11 20:56:56 | A2 |
| 4E3CBB3ACF5A7FB5580F447B87BB6AF0 | 11111 | 2017-11-11 20:57:17 | A3 |
+----------------------------------+-------+---------------------+------+
3 rows in set (0.00 sec)mysql> select model,max(dates),who from unfinished where del!=1 and model='11111' order by `max(dates)` asc limit 100;
+-------+---------------------+------+
| model | max(dates) | who |
+-------+---------------------+------+
| 11111 | 2017-11-11 20:57:17 | A1 |
+-------+---------------------+------+
1 row in set (0.00 sec)为什么打印出来who不是A3呢?
如何让max或者min时,旁边字段一起关联呢? 只有单独max或者min时,就单独取该段的值,旁边的字段根本不是关联新手请教,万分感谢
| id | model | dates | who |
+----------------------------------+-------+---------------------+------+
| DB86A82A4D43AE94330F599281FF0A37 | 11111 | 2017-11-11 20:56:35 | A1 |
| F2B8467F36A00F7760BF142A6493EE71 | 11111 | 2017-11-11 20:56:56 | A2 |
| 4E3CBB3ACF5A7FB5580F447B87BB6AF0 | 11111 | 2017-11-11 20:57:17 | A3 |
+----------------------------------+-------+---------------------+------+
3 rows in set (0.00 sec)mysql> select model,max(dates),who from unfinished where del!=1 and model='11111' order by `max(dates)` asc limit 100;
+-------+---------------------+------+
| model | max(dates) | who |
+-------+---------------------+------+
| 11111 | 2017-11-11 20:57:17 | A1 |
+-------+---------------------+------+
1 row in set (0.00 sec)为什么打印出来who不是A3呢?
如何让max或者min时,旁边字段一起关联呢? 只有单独max或者min时,就单独取该段的值,旁边的字段根本不是关联新手请教,万分感谢
[征集]分组取最大N条记录方法征集,及散分....