表1
id money
1 2.5
........
表2
id1 money1
1 3
.......
用表2去修改表1的内容,我写的是:
update 表1 set money=(select a.money1 from 表2 a where a.id1=id)
where id in (select id1 from 表2)
一共30万条,执行很慢,请教更好的方法.马上给分,谢谢
id money
1 2.5
........
表2
id1 money1
1 3
.......
用表2去修改表1的内容,我写的是:
update 表1 set money=(select a.money1 from 表2 a where a.id1=id)
where id in (select id1 from 表2)
一共30万条,执行很慢,请教更好的方法.马上给分,谢谢
as
select a.id,b.money1 from 表1 a,表2 b
where a.id=b.id1;update 表1 set money=(select a.money1 from 表3 a where a.id1=id)建个临时表,不知道会不会快点!
update 表1 b set money=(select a.money1 from 表2 a where a.id1=b.id)
如果还不行,应该在id1、id 上建立索引。