declare @test table(a1 char(10),b2 bit,c3 char(10),d4 char(10),e5 int)
insert @test 
SELECT a.a1,a.b2,a.c3,a.d4,a.e5
FROM test a right JOIN
          (SELECT distinct a1, MAX(e5) as e5
         FROM test
         GROUP BY a1) b
on a.e5=b.e5