![](/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.