select (@rowNO := @rowNo+1) AS rowno,`CODE` from ( select `CODE` from tms_order )a ,(select @rowNO :=0) b
预览: