mysql 多表update
程序员文章站
2022-05-24 21:08:45
...
-- 方式1
update uc_organization,uc_users
set uc_organization.org_name=uc_users.nick_name
where uc_organization.uid=uc_users.uid and (uc_organization.org_name is null or uc_organization.org_name='')
-- 方式2
update uc_organization inner join uc_users
on uc_organization.uid = uc_users.uid
set uc_organization.org_name=uc_users.nick_name
where uc_organization.org_name is null or uc_organization.org_name=''
UPDATE aq_users_expan,aq_answer
SET aq_users_expan.`answer_count`=(SELECT COUNT(*) FROM aq_answer WHERE aq_answer.uid=aq_users_expan.`uid`)
上一篇: cron表达式(七子表达式)
下一篇: Flask 学习过程