易截截图软件、单文件、免安装、纯绿色、仅160KB

sql server2000 数据比较 - MS-SQL Server / 应用实例

好:
 问一个问题,现在有两个数据库A,B,A中有一个c表,B中有一个d表,且这两个表的结构是一样的,现在c表有1200多万记录,d表也有1200多万记录,现在想把这两个表中不同的记录查出来,插到另一个表中,请教大家怎么办,数据很大,不知道怎么办,谢谢了
不同是怎么区分的?

给个示例?

按表中指定的某几个字段值进行区分

select a.* from a where a.id not in (select id from b)

insert into des_table 
select * from database1.dbo.table1 a where not exsits (select 1 from database2.dbo.table2 where col1= a.col1 and col2=a.col2 and...)
union all 
select * from database2.dbo.table2 b where not exsits (select 1 from database1.dbo.table1 where col1= b.col1 and col2=b.col2 and...)

引用
insert into des_table
select * from database1.dbo.table1 a where not exsits (select 1 from database2.dbo.table2 where col1= a.col1 and col2=a.col2 and...)
union all
select * from database2.dbo.table2 b where not exsits (select 1 from database1.dbo.table1 where col1= b.col1 and col2=b.col2 and...)

up…

三楼,效率如何啊,我这可是1000多万数据啊

全1000多万要什么效率? 等结果出来就好了,难到你经常用这个?


7楼你没有明白我的意思,我不是说经常用,我就是用一次,如果结果出来要很长时间,比如几天什么的,那肯定很麻烦了啊,呵呵


相关问答:

数据以xml格式返回 - MS-SQL Server / 应用实例

从数据库中查询一张表的数据
select 部门,姓名 from tb
如何才能生成下面的xml格式
XML code:
<folder state="unchecked" label="全部">
   <folder state="unchecked&qu ......

求一sql语句 - MS-SQL Server / 疑难问题

现在有两张表:文章主表A(articleId,articleTitle),文章评论表B(commentId,articleId,commentTitle)
现在我想实现这样的功能:列出文章列表,其中每篇文章标题下面列出此文章的前2个文章评论,请问sql语句怎么写啊 ......

求一个SQL语句 - MS-SQL Server / 基础类

字段1,字段2.....字段N,Status,ParentID
1,Name1....test1,1,99
1,Name1....test1,3,99
1,Name2....test2,1,101
1,Name2....test2,3,101
1,Name3....test3,2,101
1,Name1....test1,4,101
想要的结果是:
1,Na ......

SQL语句问题 - MS-SQL Server / 疑难问题

请教高手:
 以下是数据库中的三条记录,英文为字段名称  
  id planname TaskBeginTime Status
329 2010年03 ......

asp wap sql语句中获取的汉字不好事 - Web 开发 / ASP

SQL code:

rs.open "select * from guide where city_name='北京' order by pai desc",conn,1,1
do while not rs.eof or rs.bof
。。
。。
。。
rs.movenext
loop
这个sql语句在wap站里 本身有 ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号