码迷,mamicode.com
首页 > 其他好文 > 详细

不带查询条件的分页

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

标签:des   tar   c   art   cti   a   

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

不带查询条件的分页

标签:des   tar   c   art   cti   a   

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

(1)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!