SQLzoo.net

return a sequential record count for all records returned

MySQL
this should be simple - I would like to get a consecutive numbering count/id for each record returned from a query: eg: select * from tablex gives multiple rows like:
field1, field2, field3, ...
field1, field2, field3, ...
field1, field2, field3, ...
What I want is:
1, field1, field2, field3, ...
2, field1, field2, field3, ...
3, field1, field2, field3, ...
4, field1, field2, field3, ...


Specific to MySQL
This should be simple - but it isn't. Here is a nasty work around...
Copy the required table into another with auto-increment:

Related links:

  • META DATA