select * from Items a
where not exists (
select 1 from Items b
where b.CategoryId = a.CategoryId
and b.ItemId <> a.ItemId
and ((b.ItemValue > a.ItemValue) or
(b.ItemValue = a.ItemValue
and b.ItemId > a.ItemId)));