MySQL 获取记录的行号

SELECT * FROM (SELECT a.Bus_Name,(@rowNum:=@rowNum+1) as rowNo FROM a INNER JOIN (SELECT @rowNum:=-1)r) AS b WHERE b.Bus_Name = 'bus1';

你可能感兴趣的:(mysql,数据库)