SELECT (SELECT COUNT(id) FROM srcTableName AS tbl1 WHERE tbl1.id<=tbl2.id) as
seq,field1,field2,...,fieldn
FROM srcTableName AS tbl2 ORDER BY 1 ;
SELECT @rownum:=@rownum+1 AS 序号, a.* FROM t_user a ,(SELECT @rownum:=0) r;
set @rownum=0;
select a.*, @rownum := @rownum +1 as id from a;