如何在MS Access中选择第n行? [英] How can I select the nth row in MS Access?

查看:227
本文介绍了如何在MS Access中选择第n行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个MS Access数据库,正在处理其中一个表.当我按日期使用选择查询顺序时,它给出了大约1000行.我只想显示第三行.如何使用仅向我提供第三行输出的选择查询?

I have a MS Access database and I am working on one of its table. When I use the select query order by date, it gives 1000 approx rows. I want to display the 3rd row only. How can I use the select query that provides me with an output of 3rd row only?

推荐答案

嵌套查询可以做到,就像这样:

nested query would do it, something like this:

declare @table table (id int)
insert into @table values (1),(2),(3),(4),(5)

select top 1 id from
(
    select top 3 id from @table
    order by id desc
) t
order by t.id asc

刚刚注意到您说它是MS-Access,但选择查询仍然是相同的

Just noticed you said it was MS-Access, The select query would still be the same

这篇关于如何在MS Access中选择第n行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆