开发者

obtain number row in access

开发者 https://www.devze.com 2023-02-25 20:03 出处:网络
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 sequenc

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

精彩评论

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