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.
我想删除表参与者投票中 id 与另一个表行的 id 匹配的所有记录。
这可以在一个查询中完成吗?
这是我现在的查询,它返回我的子选择包含多行的错误
DELETE FROM WHERE participant_voteid =(从 WHERE 中选择 id = :facebookid)votefacebookid
participant_vote
vote
facebookid
是的。使用IN运算符而不是=运算符。
IN
=
DELETE FROM participant_vote WHERE id IN ( SELECT id FROM vote WHERE facebookid = :facebookid )
DELETE FROM participant_vote WHERE id IN (SELECT id FROM vote WHERE facebookid = :facebookid)
IN是诀窍。我的感觉是,搜索消息也会提供答案。