DB and Code snippets28 Apr 2007 07:06 am
I got tired looking for a good solution to imitate a rownum in MySQL every time I need it. Here I post the most
universal solution that doesn’t need a script mode and can be executed in a single statement:
SELECT @rownum:=@rownum+1 rownum, t.*
FROM (SELECT @rownum:=0) r, mytable t;
FROM (SELECT @rownum:=0) r, mytable t;
This solution and others you can find in comments to the MySQL Reference Manual.



July 10th, 2008 at 4:17 am
Hi,
Thanks for ur post, its really helped me a lot.
I was looking for exact one like this.
Am really very very thankful to u.
July 30th, 2008 at 7:31 am
Hi, another solution for Oracle´s rownum function :
“select * from table_name limit 0,10;”
I use max of 10 rows for this case.
Rodrigo