![](/img/trans.png)
[英]Get the net value of a Mysql number filed based on the value of another field in the same table
[英]MySQL updating a Boolean field value based on the duplicated appearance of another filed value of the same row from another table
我有一张桌子(无效),如:
电子邮件(varchar 50),国家/地区有效吗? (2)
和另一个表(活动),例如:
电子邮件(varchar 50),国家
我想检查“活动”中电子邮件列中的任何地址是否也在“非活动”表中,如果是这样,它将更新“活动”吗? 列至:0/1或是/否。
update test1
inner join test2
on test1.email = test2.email
set test1.active = 1
;
使用UPDATE LEFT JOIN尝试以下解决方案:
UPDATE inactive i LEFT JOIN active a USING(email)
SET i.`active?` = 1
WHERE a.country IS NOT NULL
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.