UPDATE user_system_info
SET user_status = 2
WHERE
user_id = ( SELECT USER.user_id FROM `user` JOIN user_system_info WHERE USER.user_id = user_system_info.user_id AND USER.user_name = '测试')
请问这个mysql语法有啥问题,想在update 里面加一个select
= =#这就是一个“连表更新”的操作;直接舍掉select查询;
====================
UPDATE user_system_info a LEFT JOIN `user` b ON a.user_id = b.user_id JOIN user_system_info c ON b.user_id = c.user_id SET a.user_status = 2 WHERE b.user_id IS NOT NULL AND c.user_id IS NOT NULL AND b.user_name = '测试'
user_id = ( SELECT USER.user_id FROM `user` JOIN user_system_info on USER.user_id = user_system_info.user_id WHERE USER.user_name = '测试')
user_id = (
SELECT USER.user_id
FROM `user`
, user_system_info
WHERE USER.user_id = user_system_info.user_id AND USER.user_name = '测试')
user_id in (SELECT USER.user_id FROM user JOIN user_system_info on USER.user_id = user_system_info.user_id WHERE USER.user_name = '测试')
是不是报返回多行的错误?