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 -- 设置排序号