0

How can i select rows from 500 to 1000 using the select statement?

ruakh
  • 175,680
  • 26
  • 273
  • 307
user1570048
  • 880
  • 6
  • 35
  • 69

2 Answers2

2

In most databases, you would use something like row_number() over (order by col1, col2) to assign a row number to a specific ordering. Then you can request rows x through y. See here.

Since MS-Access doesn't have analytic functions like row_number(), you have to be a bit more creative. Here's a KB article that might help you.

dcp
  • 54,410
  • 22
  • 144
  • 164
2

Without more info, I will suggest selecting the top 1000, then selecting the bottom 500 from that.

Edit: Record order is by field called name. Perhaps something like:

select top 500 name
from 
(
select top 24000 name
from table
order by name
)
order by name desc

Please note: Name is a reserved word and a bad choice for a field name.

mikeY
  • 519
  • 4
  • 14
  • what about the 1000 and 2000?! – user1570048 Aug 09 '12 at 17:04
  • @user1570048 I have no idea what you are talking about. 2000? There are brilliant people here. If you provide more information I'm sure you will have an answer in minutes. – mikeY Aug 09 '12 at 17:07
  • i have like 36000 records for example i want to be able to select between 23500 and 24000 and so on :) – user1570048 Aug 09 '12 at 17:10
  • 1
    @user1570048 You have been asked a number of times about how the records are ordered. Just exactly how is record 23,500 determined? If you can provide that, I'm sure an answer would be forthcoming. – mikeY Aug 09 '12 at 17:12
  • alphabetically by column called "name" – user1570048 Aug 09 '12 at 17:14