MySQL UPDATE tb1 SET fn1=val WHERE fn IN (SELECT fn FROM tb2)
时间:2015-10-11 18:20 来源:linux.it.net.cn 作者:IT
正确的写法:
-
--最先让人想到的写法
-
UPDATE buyer SET is_seller=1 WHERE uid IN (SELECT uid FROM seller)
-
-- 网上的一种
-
UPDATE buyer a,seller b SET a.is_seller=1 WHERE a.uid=b.uid
UPDATE tb1 t1 ,tb2 t2 set t1,fn1=t2.fn2 where t1.id=t2.id
(责任编辑:IT)
正确的写法:
UPDATE tb1 t1 ,tb2 t2 set t1,fn1=t2.fn2 where t1.id=t2.id |