mysql查询结果添加序列号

1、SET @i = 0;
   SELECT (@i:=@i+1) AS i FROM major;

 

2、SELECT (@i:=@i+1) AS i FROM major,(SELECT @i:=0) t;

posted @ 2021-03-10 16:55  wujingqi  阅读(81)  评论(0编辑  收藏  举报