Tuesday, October 7, 2008

Displaying row number in mysql

Try the following piece of code -
SELECT @rownum:=@rownum+1 AS "Count", m.* FROM member AS m, (SELECT @rownum:=0) AS temp ORDER BY firstname DESC

Obviously, choose the second table ('member' in my example) appropriately