How to select a row based on its row number?

前端 未结 6 1490
猫巷女王i
猫巷女王i 2020-12-28 18:12

I\'m working on a small project in which I\'ll need to select a record from a temporary table based on the actual row number of the record.

How can I select a record

6条回答
  •  情书的邮戳
    2020-12-28 18:47

    This will give you the rows of the table without being re-ordered by some set of values:

    SELECT ROW_NUMBER() OVER (ORDER BY (SELECT '1')) AS RowID, * FROM #table 
    

提交回复
热议问题