create table #(id int, tpye int, value int)
insert into # select 1 , 1 , 34
union all select 2 , 2 , 23
union all select 3 , 3 , 39
union all select 4 , 1 , 34
union all select 5 , 2 , 25
union all select 6 , 3 , 23
union all select 7 , 1 , 33
union all select 8 , 2 , 25
union all select 9 , 3 , 38
union all select 10 , 1 , 26
select id=min(id),tpye,value=max(value) from (select * from # as b where not exists (select * from # where b.tpye=tpye and value>b.value))t group by tpye
create table tab(id int,tpye int, value int)
insert tab
select 1,1,34
union
select 2,2,23
union
select 3,3,39
union
select 4,1,34
union
select 5,2,25
union
select 6,3,23
union
select 7,1,33
union
select 8,2,25
union
select 9,3,38
union
select 10,1,26
select t.*
from tab t
where not exists(select 1 from tab where tpye=t.tpye and id<t.id)