给mysql结果集加编号

set @my_int = 1;
select
@my_int := @my_int + 1 as rownum,e.*
from
aoteman e;

select
@rownum := @rownum + 1 as rownum,
e.*
from (
select @rownum := 0) r,
aoteman e;

发表评论

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: