对于数据库中已经存在的数据,根据查询条件,将sort字段按照查询序号排序。

SELECT @t:=0;
update
organization_info
set  sort=(@t:=@t+1)
where org_area_code=#{orgAreaCode} and  is_valid=1  ORDER BY sort

相关文章: