在 MS Access 上返回行号
我有 4 个表,我在选择查询中的联接的帮助下从中选择数据...我想要每个记录在获取时有一个序列号(行号)。第一个获取的记录应该是 1,下一个是 2,依此类推...
在 oracle 中,RowNum 中的等值。
I have 4 tables, from which i select data with help of joins in select query...I want a serial no.(row number) per record as they are fetched. first fetched record should be 1, next 2 and so on...
In oracle the equiavelent in RowNum.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
Brettski 的答案是 ASP 风格的,需要大量编辑。
以上是您的基本语法。您可能会发现它运行得很慢。我的典型解决方案是带有自动编号字段的存储桶表。这看起来很笨拙,但它给了我控制权,并且可能在这种情况下它允许速度。
The answer by Brettski is ASP flavored and would need a lot of editing.
Above is your basic syntax. You are likely to find this runs very slow. My typical solution is a bucket table with Autonumber field. That seems kludgy, but it gives me control and probably in this case it allows speed.
在 Access 中使用排序的 Make Table 查询,我使用以下命令(如果您查看查询,则不会工作,因为当您不希望它增加时,这会增加数字)....
Using a sorted Make Table Query in Access, I use the following (wouldn't work if you look at the Query, as that would increment the number when you don't want it to)....
通过下表,
您可以使用子查询来创建计数行:
此方法的问题是,如果结果集中存在重复项,计数将会关闭。
这篇文章很好地解释了如何向查询添加行计数列。
With the following table
You can use a sub query to create the counting row:
The problem with this method is that the count will be off if there are duplicates in your results set.
This article explains pretty well how to add a row counting column to your query.