mysql中批量update数据

创建临时表

 

 

UPDATE sys_user,
(
SELECT
min(id) AS id
FROM
sys_user
WHERE
invitation_expert_user_id = '8a2ebe035de8881e015e134139442b93'
AND type = 4
AND del_flag = 0
GROUP BY
id
) AS tmp
SET sys_user.invitation_agent_user_id = '014282c8c3de4d80ab2c4f72d384d6c2',
sys_user.remarks = '高洪蛟老师做代理之前作为医生邀请的医生'
WHERE
sys_user.id = tmp.id

 

posted @ 2018-04-17 09:24  Roger胜  阅读(206)  评论(0编辑  收藏  举报