MySQL查询设置排序号1,2,3

SELECT DISTINCT
 (@i :=@i + 1) AS num,  -- 设置排序号
 b.pb_dl_name, 
 a.*
FROM xqxz_familyinfo a
LEFT JOIN xqxz_planbuild b ON a.pb_id=b.pk_id,
(SELECT @i := 0) AS it  -- 设置排序号

 

posted @ 2019-05-15 11:31  Peter.Jones  阅读(1027)  评论(0编辑  收藏  举报