我得到子查询返回多行的错误。如何解决这个问题:
UPDATE sales
SET newsletter='0'
WHERE (user_id='33' AND product_id=(SELECT product_id FROM phplist_list WHERE id = (SELECT listid FROM phplist_listmessage WHERE messageid='20')))
答案 0 :(得分:2)
您可以使用in
代替=
来解决此问题:
UPDATE sales
SET newsletter='0'
WHERE user_id = '33' AND
product_id in (SELECT product_id
FROM phplist_list
WHERE id in (SELECT listid
FROM phplist_listmessage
WHERE messageid = '20'
)
)