开发者

obtain number row in access

SQL Server:

SELECT col1, col2,ROW_NUMBER() OVER (order BY col1) AS intRow FROM Table1 

What is 开发者_如何学编程the equivalent code in Access?


In short, there is no equivalent. If you want a sequence, one way to do it is to create a table with an AutoNumber column. Another way would be something like:

Select ..,
    , (
        Select Count(*)
        From MyTable As T1
        Where T1.PrimaryKeyCol < T.PrimaryKeyCol
        ) + 1 As Seq
From MyTable As T

However, if the table is large, that may not perform well.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜