SELECT @rownum:=@rownum+1 as rownum, p.* FROM MYTABLE p , (SELECT @rownum:=0)*r*