In Oracle, it\'s possible to do a SELECT
statement that returns the row number as a column in your result set.
For example,
SELECT rownu
Qualify the * with the name of the table:
select rownum, table.* from table
Unfortuantely, i dont think therei s a way to do it, easiest is probably inner join with itself with an inline table of id,count(*), and put an outer select statement
Dave's answer is great, i'd just like to add that it's also possible to do that by placing the wildcard as the first column:
select *,rownum from table
Works, but the following won't:
select rownum,* from table
I've tested on MySQL.