Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

T-SQL to return a specific range of records

Status
Not open for further replies.

glyn6

Programmer
Joined
Nov 2, 2009
Messages
561
Location
GB
You can select the top x number of records by using
SELECT TOP 10 * FROM table
is there a t-sql way of getting the 11th to the 20th records for example?
ta
 
In SQL 2005 and up:
Code:
;with cte as (select *, row_number() over (order by SomeField) as Row from Table)

select * from cte where Row between 11 and 20

PluralSight Learning Library
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top