update t1
set c2 = ( select t2.c2 from t2 where t1.c1 = t2.c1);
这条语句把t1中的c2全改一变,双表联接条件不成立者也改,被置为空了。如果想只改双表联接条件成立的记录用:
update t1
set c2 = ( select t2.c2 from t2 where t1.c1 = t2.c1)
where exists ( select 1 from t2 where t1.c1 = t2.c1);
set c2 = ( select t2.c2 from t2 where t1.c1 = t2.c1);
这条语句把t1中的c2全改一变,双表联接条件不成立者也改,被置为空了。如果想只改双表联接条件成立的记录用:
update t1
set c2 = ( select t2.c2 from t2 where t1.c1 = t2.c1)
where exists ( select 1 from t2 where t1.c1 = t2.c1);
set c2 = t2.c2
from t1, t2
where t1.c1 = t2.c1;------------------>>>>>update t1
set c2=(select c2 from t2 where t1.c1=t2.c1)
where exist(select 1 from t1,t2 where t1.c1=t2.c1)
//bow again~~