Register now and start sharing your code snippets.
-->
MySQL rownum equivalent
SQL posted 8 months ago by christian
MySQL doesn’t have rownum, but user variables can be used as a replacement:
1 select @rownum:=@rownum+1 'rank', p.* from products p, (SELECT @rownum:=0) r order by created_at desc limit 10;
Read more: MySQL 5.0 Reference Manual