sql獲取分組後取某字段最大一條記錄

獲取分組後取某字段最大一條記錄 方法一:(效率最高) select * from test as a where typeindex = (select max(b.typeindex) from test as b where a.type = b.type ); 方法二:(效率次之) select a.* from test a, (select type,max(typeindex) typ
相關文章
相關標籤/搜索