两句查完:
set @rownum=0;
select (@rownum:=@rownum+1),colname from [tablename or (subquery) a];
一句查完:
select @rownum:=@rownum+1,colnum from (select @rownum:=0) a,[tablename or (subquery) b];
两句查完:
set @rownum=0;
select (@rownum:=@rownum+1),colname from [tablename or (subquery) a];
一句查完:
select @rownum:=@rownum+1,colnum from (select @rownum:=0) a,[tablename or (subquery) b];