有一个Remark
包含数据的表,如下所示:
SerialNo | RemarkNo | Desp
=============================================
10 | 1 | rainy
10 | 2 | sunny
11 | 1 | sunny
11 | 2 | rainy
11 | 3 | cloudy
12 | 1 | rainy
如果我运行查询SELECT * FROM remark WHERE remark_no IN (SELECT MAX(remark_no) FROM remark GROUP BY serial_no);
,我仍然会得到上述结果:
什么查询将返回以下结果:
10 | 2 | sunny
11 | 3 | cloudy
12 | 1 | rainy
也就是每组最后一条记录应该返回??