Oracle rownum function
How I can get rownum in orac开发者_C百科le over order by name? i.e In SQL I have a query
SELECT
ROW_NUMBER() OVER(ORDER BY FIRSTNAME) SRL
FROM
[SECURITY].[USERS]
ORDER BY
FIRSTNAME
How will it be in Oracle?
SELECT ROW_NUMBER() OVER(ORDER BY FIRSTNAME)SRL FROM USERS
In Oracle, ROWNUM
refers to the current record in the result set (which should be ordered).
SELECT ROWNUM AS SRL
FROM USERS
ORDER BY FIRSTNAME
EDIT: THIS IS WRONG. ROWNUM is assigned BEFORE ordering.
精彩评论