How do I return a row and an ascending counter as a result set?
如何将一行和升序计数器作为结果集返回?
2 个解决方案
#1
3
It depends on your RDMS, but there's probably a RANK
or ROW_NUMBER
function.
它取决于您的RDMS,但是可能有一个RANK或ROW_NUMBER函数。
#2
2
If its SQL Server you can do it with the following syntax:
如果它的SQL服务器可以使用以下语法:
SELECT ROW_NUMBER() OVER (ORDER BY COLUMN_NAME) AS Id, column1, column2, ....
#1
3
It depends on your RDMS, but there's probably a RANK
or ROW_NUMBER
function.
它取决于您的RDMS,但是可能有一个RANK或ROW_NUMBER函数。
#2
2
If its SQL Server you can do it with the following syntax:
如果它的SQL服务器可以使用以下语法:
SELECT ROW_NUMBER() OVER (ORDER BY COLUMN_NAME) AS Id, column1, column2, ....