Microsoft Access和分页大型数据集 [英] Microsoft Access and paging large datasets
问题描述
是否有通过简单的SQL使用Access数据库对大型数据集进行分页的简便方法?假设我的查询通常返回100行,但是我希望查询对结果进行分页,以便它仅检索(比方说)前10行.直到我请求接下来的10行时,它才会查询11-20行.
Is there an easy way to page large datasets using the Access database via straight SQL? Let's say my query would normally return 100 rows, but I want the query to page through the results so that it only retrieves (let's say) the first 10 rows. Not until I request the next 10 rows would it query for rows 11-20.
推荐答案
如果运行排名查询,您将在输出中获得包含升序数字的列.然后,您可以使用BETWEEN...AND
子句对此列运行查询,以执行分页.
If you run a ranking query, you will get a column containing ascending numbers in your output. You can then run a query against this column using a BETWEEN...AND
clause to perform your paging.
例如,如果您的页面每个包含10条记录,而您想要第三页,则可以这样做:
So, for example, if your pages each contain 10 records and you want the third page, you would do:
SELECT * FROM MyRankingQuery WHERE MyAscendingField BETWEEN 30 and 39
如何在查询中对记录进行排名
Microsoft支持KB208946
这篇关于Microsoft Access和分页大型数据集的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!