首页 > 其他 > 详细

不带查询条件的分页

时间:2014-05-09 13:17:25      阅读:486      评论:0      收藏:0      [点我收藏+]

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

不带查询条件的分页,布布扣,bubuko.com

不带查询条件的分页

原文:http://www.cnblogs.com/q101301/p/3718377.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!