mysql取查询记录的行号

mysql取查询记录的行号

select (@rowNum:=@rowNum+1) as rowNo,tmp.* from (子查询) as tmp,(Select (@rowNum :=0) ) b