sql - Query similar to TOP 10 to select inbetween records? -
I have 100 records in which I can select the top 10 using the query "Top 10". Is there anything to get 20th to 30th records like this?
Use the "new" ROW_NUMBER () function because you are using SQL Server 2005 Line 11 to 20:
select details, date (date ROW_NUMBER (date) by date (Date by date DESC), description, date from log) logwthRONN.NL WHERE RO & Gt; = 11 and the line & lt; = 20 If you have a lot of records, then using the top X in the internal selection collection can slow things down because 1000 records are not returned back if you only 11 You can get 20 records from:
SELECT Description, Date FROM (SELECT TOP 20 ROW_NUMBER () date (ORDER BY DESC) line, description, date from log) AS logwith for WHERE Line & gt; = 11 and the line & lt; = 20
Comments
Post a Comment