As ranges instead of individual records
select A.CategoryId, A.SubCategoryId, isnull((
select top(1) c.sequenceNumber from TableA C
where A.CategoryId=C.CategoryId and A.SubCategoryId=C.SubCategoryId
and c.sequenceNumber<A.sequenceNumber
order by c.sequenceNumber desc
)+1,1) [From], A.sequenceNumber-1 [To]
from TableA A
where A.sequenceNumber>1 and not exists (
select * from TableA B
where A.CategoryId=B.CategoryId and A.SubCategoryId=B.SubCategoryId
and B.sequenceNumber=A.sequenceNumber -1)