mysql: rownum functionality

Here are some examples how to use “rownum” functionality (similar to Oracle) in mysql


update mytable
set col1 = 'somevalue'
order by col2
limit 300

rownum analog:


select @rownum:=@rownum+1 rownum, mytable.*
from (select @rownum:=0) r, mytable;

One thought on “mysql: rownum functionality

  1. Thank you so much….I was lloking for this and I found in 3rd page in google search…

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.