Pure-SQL Technique for Auto-Numbering Rows in Result Set

前端 未结 9 1091
误落风尘
误落风尘 2020-12-29 00:20

I\'m looking for a way to sequentially number rows in a result set (not a table). In essence, I\'m starting with a query like the following:

SELECT         


        
9条回答
  •  礼貌的吻别
    2020-12-29 00:54

    There is no ANSI-standard way to do this of which I am aware.

    In SQL Server you have a ROW_NUMBER() function which can be used and in Oracle, there is a ROWNUM pseudo column.

    In MySQL, there is this technique

提交回复
热议问题