代码如下: –代码一DECLARE cc INT SELECT NewsId,ROW_NUMBER() OVER(ORDER BY SortNum DESC) AS RowIndex INTO #tb FROM news WITH(NOLOCK) WHERE NewsTypeId=NewsTypeId AND IsShow=1 SET cc = ROWCOUNT SELECT n.* FROM news AS n WITH(NOLOCK), #tb As t WHERE t.RowIndex&g