Is there a way to get the row number in Mysql like the rownum in oracle [duplicate]

Until MySQL finally supports modern SQL, the only way to get something similar is this:

SELECT @rownum:=@rownum + 1 as row_number, 
       t.*
FROM ( 
   < your original query goes here >
) t,
(SELECT @rownum := 0) r

Leave a Comment