select max(id) as id,table_id,App_type,max(App_level) as App_level,App_status from table group by table_id,App_type,App_status
没测试过,不知道行不行 select * from tablename where id in (select id,max(App_level) as app_level ) from tablename group by table_id)
没有那么复杂吧,楼主试试这个。Select * from 表 A Where Not Exists (Select * from 表 Where table_id=A.table_id And App_level>A.App_level)
这样应该也可以: select * from 表 a,(select table_id,max(app_level) app_level from 表 group by table_id) b where a.table_id=b.table_id and a.app_level=b.app_level
group by table_id,App_type,App_status
select * from tablename
where id in
(select id,max(App_level) as app_level ) from tablename group by table_id)
select * from 表 a,(select table_id,max(app_level) app_level from 表 group by table_id) b
where a.table_id=b.table_id and a.app_level=b.app_level