Firebird 3 – How to get record number of dataset
How to get record number of dataset using row_number window function with over().
1 2 3 4 |
SELECT row_number() over(), t.* FROM test t |
Example of record number of dataset with even and odd column sorting.
1 2 3 4 5 6 7 8 9 |
SELECT row_number() over(), (CASE WHEN mod(row_number() over(),2) = 0 THEN 'even' ELSE 'odd' END) AS my_column, custom.* FROM ( SELECT t.* FROM test t ORDER BY t.description ) custom |