从实际意思上,至少外边应该加个条件吧,不然就全给UPDATE了
update test1
set test1.c2 = (select test2.c2 from test2 where test2.c1 = test1.c1)
where test1.c1 in (select test2.c1 from test2);
如果这样考虑的话,还需要加一个条件
update test1
set test1.c2 = (select test2.c2 from test2 where test2.c1 = test1.c1 )
whereexists (select 1 from test2 where test2.c1=test1.c1and test1.c2test.c2)
数据量没有太大的差异情况下,最好不要用IN 或NOT IN
1.Create table test1_dup
as select distinct a,.. b a... , b.c2
from test1 a, test2 b
where a.c1 = b.c2(+)
2.create index / grant on test1_bak
3.drop test1
4.rename test1_bak to test1
最初由 rollingpig 发布
[B]1.Create table test1_dup
as select distinct a,.. b a... , b.c2
from test1 a, test2 b
where a.c1 = b.c2(+)
2.create index / grant on test1_bak
3.drop test1
4.rename test1_bak to test1 [/B]
谢谢各位发言
这样的资料量需要每天更新一次,要写成一次procedure.
rollingpig做法,我在>(itpub)
拜读过.
但是这样需要手动去做.
公司希望每天自动更新.?