delete a from a,b where a.id=b.id
insert into A
select b.* from b where b.id in (select B.id from A,B where A.id =b.id)
要实现的是,先删除a表中的id和b表中id相同的记录,再把b表中的这些记录插入到a表中
insert into A
select b.* from b where b.id in (select B.id from A,B where A.id =b.id)
要实现的是,先删除a表中的id和b表中id相同的记录,再把b表中的这些记录插入到a表中
解决方案 »
- 谁知道JVDebugHandle是什么?哪有下载?
- 错误提示:Package C:\windows\system32\rbrcl77.bpl can't be installed because it is not a design time package
- 微软脚本语言解密源程序scrdec V1.7,哪位好心人帮忙译成DELPHI!!
- 很急,很急的问题
- SOS!国外邮件,一堆乱码,如何显形?MM
- 急救!一点小问题!在线等候
- 请问有不有这样一个控件?一个透明的Panel在上面放一个不规则的图形,在图形没覆盖的地方能直接点击下面的控件!有这样的东东吗?
- where ftime>#2003-5-1#可以通过,为什么where ftime>#2003-5-1 14:00:35#不能通过?
- 请大家提供delphi2.0的下载地址,一千五百分相送
- 内存泄露了,大家帮帮忙吧。
- 怎样获取服务器日期和时间?
- dbedit简单问题
insert into A
select * from b where b.id in (select B.id from A,B where A.id =b.id)
2.用存储过程和临时表吧!
而后再
delete a from a,b where a.id=b.id
insert into a
select b.* from b where b.id in (select temp.id from temp)
就是吧a表中的和b表中相同的id的数据用b中的数据更新?不要删除再加吧?
select * into #t1 from bdelete #t.a from #t,#t1 where #t.id=#t1.id
insert into b
select b.* from b where b.id in (select b.id from #t,b where #t.id =b.id)Drop table #t
Drop table #t1
from b,a
where b.id in
(
select b.id from b,a where a.id=b.id
)
这条语句不对啊!
先是 delete * from a,b where a.id=b.id
后面再 insert into A
select * from b where b.id in (select B.id from A,B where A.id =b.id)
括号里边的 select 语句是查不出记录的按照楼住的话:“要实现的是,先删除a表中的id和b表中id相同的记录,再把b表中的这些记录插
入到a表中”
这样子的话就不能“再把b表中的这些记录” 注意是“这些”记录插入到 a 表中,因为“这些”
记录已经被删除,只能是把剩下的记录插入到 a 表中
应该是 :
insert into a
select * from b