表数据
select id,(select count(*) from test1 where test=t1.test and id>=t1.id) as idd,test
from test1 as t1
order by idd
执行查询后数据
--修改结果
update test1 right join
-- 字段拼接,
(select concat(a.test,a.idd) as test1 ,a.id as id1 from
-- 为相同列数据区分出排序值
(select id,(select count(*) from test1 where test=t1.test and id>=t1.id) as idd,test
from test1 as t1
order by idd)a)a
on test1.id=a.id1
set test = a.test1