--try
select name,count,ass
from 表
where count=(select top 1 count from 表 where name=a.name)
and  ass=(select top  1 ass from 表 where name=a.name)
group by name

解决方案 »

  1.   

    alter table tb add id int identity(int)
    delete a from tb a,tb b where a.name=b.name and a.id>b.id
    alter table tb drop column id
      

  2.   

    --上面有点问题.
    --测试环境
    declare @t table(name varchar(10),count varchar(10), ass varchar(10))
    insert into @t select 'qq','jj','99'
    union all select 'qq','aa','88'
    union all select 'qq','kk','yy'
    union all select 'pp','hh','77'
    union all select 'pp','gg','22'
    union all select 'ww','cc','00'
    union all select 'ww','33','99'
    union all select 'zz','bb','99'
    union all select 'zz','oo','mm'
    --查询
    select name,
    count=(select top 1 count from @t where name=a.name),
    ass=(select top  1 ass from @t where name=a.name)
    from @t a
    group by name
    --结果
    name       count      ass        
    ---------- ---------- ---------- 
    pp         hh         77
    qq         jj         99
    ww         cc         00
    zz         bb         99(所影响的行数为 4 行)
      

  3.   

    select name, max(count),max(ass) from tablename
    group by name
    having count = max(count)
      

  4.   

    ,zlp321002(人生没有理想,那和咸鱼还有什么两样)写的精妙啊!:)