For 2005 / 2008 / 2008 R2
WITH NumberedMyTable AS( SELECT Id, Value, ROW_NUMBER() OVER (ORDER BY Id) AS RowNumber FROM MyTable)SELECT Id, ValueFROM NumberedMyTableWHERE RowNumber BETWEEN @From AND @To
;WITH cte AS( SELECT Journals.JournalId, Journals.Year, Journals.Title, ArticleCategories.ItemText, ROW_NUMBER() OVER (ORDER BY Journals.JournalId,ArticleCategories.ItemText) AS RN FROM Journals LEFT OUTER JOIN ArticleCategories ON Journals.ArticleCategoryId = ArticleCategories.ArticleCategoryId) SELECT JournalId, Year, Title, ItemTextFROM cteWHERE RN BETWEEN 11 AND 20
For 2012 this is simpler
SELECT Journals.JournalId, Journals.Year, Journals.Title, ArticleCategories.ItemTextFROM Journals LEFT OUTER JOIN ArticleCategories ON Journals.ArticleCategoryId = ArticleCategories.ArticleCategoryIdORDER BY Journals.JournalId, ArticleCategories.ItemText OFFSET 10 ROWS FETCH NEXT 10 ROWS ONLY
参考地址:
https://stackoverflow.com/questions/758186/how-to-get-n-rows-starting-from-row-m-from-sorted-table-in-t-sql
https://stackoverflow.com/questions/5620758/t-sql-skip-take-stored-procedure/5620802#5620802