select a.name,a.type,max(a.price) as price from  yourtable a,(select distinct Name from yourtable ) b
where a.name=b.name

解决方案 »

  1.   

    Select * from 表 a where price = (select max(price) from 表  where name = a.name)
      

  2.   

    上面的有点问题
    select a.name,a.type,max(a.price) as price from  yourtable a
    group by a.name,a.type
      

  3.   

    declare @t table(name varchar(10),type int,price numeric(10,2))
    insert into @t values('duwei',1,56.3)
    insert into @t values('kk',2,50)
    insert into @t values('duwei',1,90)
    insert into @t values('oo',2,80.7)
    insert into @t values('kk',2,60)
    select name,type,max(price) from @t group by name,type
      

  4.   

    select name,type,max(price) from 表 group by name,type
      

  5.   

    Select * from 表 a where 
    not exists( select 1 from 表  where a.price<price  and name = a.name)