Bug #10049 rownum functionality (alá Oracle)
Submitted: 20 Apr 2005 23:02 Modified: 7 Oct 2005 23:08
Reporter: Andris Kardos Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: General Severity:S4 (Feature request)
Version: OS:Any
Assigned to: CPU Architecture:Any

[20 Apr 2005 23:02] Andris Kardos
Description:
A quite useful missing feature. One example where ROWNUM would be really usefull if you do a INSERT INTO ... SELECT FROM ... style statement and you want to generate the primary key for the destination table on the fly. For example you have a contact db with cities for persons. You want to create a lookup table for cities, so you do INSERT INTO cities (id, name) SELECT DISTINCT ????, city FROM person. You see? Another example when you want to join something to an ordered list say lookup text "first", "second" "third" based on rownum (=order)

How to repeat:
See Oracle.

Suggested fix:
Seems to be a relatively easy thing to do.
[17 Dec 2014 13:46] Daniël van Eeden
The internals manual has a section about this:
http://dev.mysql.com/doc/internals/en/procedure-rownum.html