I have this inner join statement that works for the most part, but when I add custom paging the join returns a null set. Any suggestions will be appreciated.
This returns the results that I expect
SELECT [Id]
,[Title]
FROM
(SELECT [Id]
,[Title]
,ROW_NUMBER() OVER(ORDER BY id) as RowNum from Art) as e
INNER JOIN [ArtCat] p ON e.Id = p.ArtId
WHERE
p.CatId = @CategoryNum
This returns a null set
SELECT [Id]
,[Title]
FROM
(SELECT [Id]
,[Title]
,ROW_NUMBER() OVER(ORDER BY id) as RowNum from Art) as e
INNER JOIN [ArtCat] p ON e.Id = p.ArtId
WHERE
p.CatId = @CategoryNum
AND RowNum BETWEEN @startIndex AND (@startIndex + @pageSize)
Thanks in advance!