This works:declare @Sample table (ID int, VALUE int)insert @Sampleselect 1, 23 union allselect 2, 25 union all select 2, 30 union allselect 2, 50 union all select 3, 21 union all select 4, 80 select * from @Sampledelete dtfrom(selectrow_number() over (partition by ID order by VALUE DESC) as rownum, *from @Sample)dtwhere rownum=1and ID in (select ID from @Sample group by ID having count(*) > 1)select * from @Sample
No, you're never too old to Yak'n'Roll if you're too young to die.