I want to show row number for each of result set row, I have this query in mySQL
SELECT @rownum := @rownum + 1 row, e.* FROM Employee e, (SELECT @rownum := 0) r
Here @rownum is local variable and would increment its value for each result row. How do i write this query in db2 ( ibm's dashdb ) ?
If you are looking to set a variable and set a value:
Or
If you're just looking to number the output rows, you can use the
row_number()
function: