Select Top X records starting at record Y

自闭症网瘾萝莉.ら 提交于 2020-12-27 07:15:17

问题


I am using MS Access VBA to make a few queries. I have a list of about 4000 items and I need query 1 to be the top 739 items and query 2 to be the top 428 items starting at record 740 and I need query 3 to be the rest starting at record 1168.

is there any way to do this?

Thank you.


回答1:


First, create a query that will assign an ID to each record using one of the methods listed in my project VBA.RowNumbers.

The function RowNumber may fit you.

You will have to use a compound key (say, Field1 & "|" & Field2 & "|" & Field9) to obtain something unique, or you can't do this.

Then run these queries:

Select * From YourQuery
Where ID Between 1 And 739

Select * From YourQuery
Where ID Between 740 And 1167

Select * From YourQuery
Where ID >= 1168


来源:https://stackoverflow.com/questions/65039788/select-top-x-records-starting-at-record-y

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!