我有这个在大多数情况下都有效的内部连接语句,但是当我添加自定义分页时,连接返回一个空集。任何建议将不胜感激。
这将返回我期望的结果
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
这将返回一个空集
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)
提前致谢!