方法一(按字段1分组): select a.字段1,max 字段2别名,b.字段3,b.字段4... from (select 字段1,max(字段2) max from tablename group by 字段1) a,tablename b where a.字段1=b.字段1 and a.max=b.字段2;方法二(按字段bh分组): select * from tablename where (bh,cs) in (select bh,max(cs) from tablename group by bh);
select a.字段1,max 字段2别名,b.字段3,b.字段4... from (select 字段1,max(字段2) max from tablename group by 字段1) a,tablename b where a.字段1=b.字段1 and a.max=b.字段2;方法二(按字段bh分组):
select * from tablename where (bh,cs) in (select bh,max(cs) from tablename group by bh);
好像很不合理!