declare @t table(key1 int , time1 int , value int)
insert @t select
1 , 100 , 5
union all select
1 , 101 , 7
union all select
1 , 102 , 9
union all select
2 , 100 , 6
union all select
2 , 101 , 10
select * from @t t1 where t1.time1=(select max(time1) from @t t2 where t1.key1=t2.key1)
--查询结果