当我们想为查询结果添加序号的时候可以这样写 SELECT @rowid:=@rowid+1 allid, pan_number, receive_person,time_note, url,unit_name,id FROM( SELECT a.pan_number,d.F_RealName receive_person, a.time_note,b.url, c.unit_name, c.id FROM medium_receiptlist_pan a left join medium_rec