Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有 3 张表员工、经理、用户。只有当员工的id与manager的id匹配时,我才想将值 1 插入users列is_manager。id在员工中是主键,在经理中是主键和外键。
任何帮助,将不胜感激。谢谢
任何一个
UPDATE users INNER JOIN managers ON users.id=managers.id SET users.is_manager=1
或者
UPDATE users SET is_manager=1 WHERE id IN ( SELECT id FROM managers )
会做。我推荐后者以获得更好的可读性。