返回MS Access上的行号 [英] Returning row number on MS Access

查看:75
本文介绍了返回MS Access上的行号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有4个表,我在选择查询的连接帮助下从中选择数据...我想要每条记录取一个序列号(行号).首先提取的记录应为1,然后为2,依此类推...

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...

在Oracle中,RowNum中的等价物.

In oracle the equiavelent in RowNum.

推荐答案

Brettski的答案是ASP风格的,需要大量编辑.

The answer by Brettski is ASP flavored and would need a lot of editing.

SELECT DCOUNT("YourField","YourTable","YourField <= '" & [counter] & "'") 
  AS RowNumber,  
  YourField as counter FROM YourTable;  

以上是您的基本语法.您可能会发现运行速度很慢.我的典型解决方案是具有自动编号"字段的存储桶表.这似乎很麻烦,但是它可以控制我,并且在这种情况下,它可以提高速度.

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.

这篇关于返回MS Access上的行号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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