你好男孩和女孩:)
我有这个问题:
SELECT * FROM customer
INNER JOIN address ON customer.customer_id = address.customer_id
WHERE address.country_id = 176
所以我想将custome.status
更新为0
我尝试使用该查询,但“0行受影响”:
UPDATE customer
INNER JOIN address ON customer.customer_id = address.customer_id
SET customer.status = 0
WHERE address.country_id = 176
我有大约200个人,地址为address.country_id = 176!
任何想法,谢谢你!
答案 0 :(得分:1)
您可以使用EXISTS而不是JOIN
尝试不同的方法UPDATE
customer
SET
status = 0
WHERE
EXISTS (
SELECT *
FROM address A
WHERE customer.customer_id = A.customer_id AND country_id = 176
)
无法回想起,但有可能MySQL不会报告状态已经等于0的记录的变化吗?