UPDATE pay_method_basic_info ft INNER JOIN ( SELECT channel_id, method_id, IF ( @channelId = t.channel_id, @row_num := @row_num + 1, @row_num := 1 ) AS row_num, @channelId := t.channel_id FROM pay_method_basic_info t ) mt ON ft.channel_id = mt.channel_id AND ft.method_id = mt.method_id SET ft.method_id = ft.channel_id * 100 + row_num
mysql 按组内顺序 分配序号
原文地址:https://www.cnblogs.com/Asuphy/p/14332393.html