MySQL分组修改排序序号
update jxgz_rymc r set Reorder = ( select i from ( SELECT ( @i := CASE WHEN @DepartmentId = t1.DepartmentId THEN @i + 1 ELSE 1 END ) AS i, (@DepartmentId := t1.DepartmentId), t1.PersonDirectoryId FROM jxgz_rymc t1, ( SELECT @i := 0 ,@DepartmentId := ‘‘ ) AS t2 ORDER BY t1.DepartmentId, t1.PersonName, t1.PersonDirectoryId ) a where r.PersonDirectoryId = a.PersonDirectoryId);
相关推荐
ztyzly00 2020-07-18
cyyking 2020-05-03
林大鹏 2020-04-30
要啥自行车一把梭 2020-03-20
唐文 2020-02-24
csdnlytPractice 2020-02-18
herohope 2020-01-20
muzirigel 2020-01-18
林大鹏 2020-01-16
minggehenhao 2020-01-08
tangjianft 2020-01-03
sofast 2019-12-29
kuwoyinlehe 2019-12-24
xiaobaif 2019-12-13
cyhgogogo 2019-12-04
mjshldcsd 2019-12-02
mycosmos 2019-12-02
wensonlee 2019-11-30
everlasting 2019-11-28