hãy thử cái này!
create table users(UserId int, Firstname varchar(30), Lastname varchar(30), IsRequired varchar(5), IsDeleted varchar(5));
insert into users values('1','harry','tom','true','false');
insert into users values('1','harry','tom','false','false');
insert into users values('3','ram','sham','true','false');
select * from
(
select *,rn=ROW_NUMBER()over(partition by UserId order by Firstname desc) from users
)x
where x.rn=1