首页 > 代码库 > 不带查询条件的分页
不带查询条件的分页
SELECT * FROM (
SELECT
ROW_NUMBER() OVER(ORDER BY ca.PraiseNum desc) as RowID
,ca.[ArticleId]
,ca.[ActivityId]
,ca.[Title]
,ca.[UserID]
,ca.[CreateTime]
,ca.[IsDeleted]
,ca.[PraiseNum]
,tu.UserName
,ca.[IsSendCoupon]
FROM [dbo].[CarArticle] ca WITH(NOLOCK)
INNER JOIN dbo.View_TradeUser tu WITH(NOLOCK) ON tu.UserID=ca.UserID
WHERE ca.ISDeleted = 0 AND ca.Status = 1 AND Marrow = 3 AND ca.[ActivityId] = @ActivityID AND tu.Islocal =0
) Temp WHERE RowID Between @StartRow AND @EndRow
SELECT @RecordCount=COUNT(*) FROM
(
SELECT
ROW_NUMBER() OVER(ORDER BY ca.PraiseNum desc) as RowID
,ca.[ArticleId]
,ca.[ActivityId]
,ca.[Title]
,ca.[UserID]
,ca.[CreateTime]
,ca.[IsDeleted]
,ca.[PraiseNum]
,tu.UserName
,ca.[IsSendCoupon]
FROM [dbo].[CarArticle] ca WITH(NOLOCK)
INNER JOIN dbo.View_TradeUser tu WITH(NOLOCK) ON tu.UserID=ca.UserID
WHERE ca.ISDeleted = 0 AND ca.Status = 1 AND Marrow = 3 AND ca.[ActivityId] = @ActivityID AND tu.Islocal =0
)TEMP