update products p
left join (
select pid, nid , enid, (select count(1) as rn from products where member='ceshi' and nid<=a.nid ) as rn from products a
where member='ceshi'
ORDER BY rn
) as t on t.pid=p.pid
set p.nid=t.rn
where p.member='ceshi'
1. 当然首先您的要排序好顺序
牧飞