select * from 表 a
where not exists(select 1 from 表 where type = a.type and id>a.id)

解决方案 »

  1.   

    select * from table where id in(select max(id) group by type )
      

  2.   

    说的不是很清楚,大概:select * from 数据表 a
    where corId (根据corId查询的条件)
    and id=(select max(id) from 数据表 where type=a.type and corId (根据corId查询的条件))
      

  3.   

    select * from table where id in(select max(id) from table group by type )
      

  4.   

    select a.* from 表 a,(select id=max(id) from 表 group by corid)b
    where a.id=b.id
      

  5.   

    select max(corId) as corId,type from table 
    group by type
      

  6.   

    select max(ID),corid,type from 表  group by type ,corid
      

  7.   

    select max(ID),corId,type from tab group by type