select 2nd - 5th records?

  • Thread starter Thread starter jim
  • Start date Start date
J

jim

hi,
i know i can get top 5th of records by
"select top 5 ..." statement.
but, how can i get 2nd - 5th records but no 1st statement?

in mysql, i can use "select ... limit 2,5".
in oracle, i can use "select ... rownum >2 and rownum < 5"

how can i do that in access?

thanks,
jim
 
Two methods I can think of:

Select the Top 4 of your Top 5 sorted in reverse order.

Or create a query that gets the top 1 vice the top 5. Then do an unmatched
query on the two queries.
 
Assuming you want the 2nd through 5th records in descending order of a field
named "Your Ordering Field", you might try a query whose SQL looks something
like this:

SELECT
[Your Table].*
FROM
[Your Table]
WHERE
[Your Table].[Your Primary Key Field] IN
(SELECT TOP 4
[Your Primary Key Field]
FROM
(SELECT TOP 5
[Self].*
FROM
[Your Table] AS [Self]
ORDER BY
[Self].[Your Ordering Field] DESC)
ORDER BY
[Your Ordering Field])
 
Back
Top