This is a sql newbie question.
Basically, I want an extra column to return with my select statement to number the rows. I'm using mysql.
Eg:
select * from friends
David
Steve
Joe
What is the syntax to get:
1 David
2 Steve
3 Joe
From: http://markmal.blogspot.com/2006/04/oracle-like-rownum-in-mysql.html
SELECT @rownum:=@rownum+1 rownum, t.*FROM (SELECT @rownum:=0) r, mytable t;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With