--id是唯一吧?
--抢先贴一个数据
if object_id('ta') is not null drop table ta
go
create table ta(id int, title varchar(10), type int)
insert ta  select 1, '记录1', 1
union all  select 2, '记录2', 1
union all  select 3, '记录3', 2
union all  select 4, '记录4', 2

解决方案 »

  1.   

    select* 
    from ta 
    where id in(select min(id) from ta group by type)
      

  2.   

    select min(ID) ID,max(Title) Title,Type from  表名 group by Type
      

  3.   

    select * from ta t where not exists(select * from ta where Type=t.type and ID>t.id )
      

  4.   

    ---再借一楼数据:
    if object_id('ta') is not null drop table ta
    go
    create table ta(id int, title varchar(10), type int)
    insert ta  select 1, '记录1', 1
    union all  select 2, '记录2', 1
    union all  select 3, '记录3', 2
    union all  select 4, '记录4', 2---结果:
    ID       Title    Type
    2 记录2 1
    4 记录4 2
      

  5.   

    ----如果特别喜欢1,4的话
    select * from ta t where not exists(select * from ta where Type=t.type and ID<t.id )
      

  6.   


    select table1.* from table1 join (select type,min(title) title from table1 group by type ) a on table1.type=a.type 
    and table1.title=a.title