那位高手提供一下,两个数据表(结构相同)内数据的比对的源码或SQl语句

lyb2003 2011-03-10 10:37:07
高分相送,内容如题!
...全文
99 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
子夜__ 2011-03-23
  • 打赏
  • 举报
回复
把两表的数据取出来 取差集。。。
yongyinmg 2011-03-22
  • 打赏
  • 举报
回复
vs2008的数据比较
ximenwuji 2011-03-15
  • 打赏
  • 举报
回复
1。a,b两个数据表中都有的相同数据
select a.* from table a,table b where a.primarykey = b.primarykey;
2. a表中有b表中没有的
select a.* from table a where a.primarykey not in(
select a.* from table a,table b where a.primarykey = b.primarykey);
3.b表中有啊,表中没有的,同2
凭海听涛来 2011-03-14
  • 打赏
  • 举报
回复
不知道是不是你想要的SQL语句
select ID,(case when tbl1.col1<>tbl2.col1 then ID+'TBL1:COL1:'+tbl2.col1+';TBL2:COL1:'+tbl2.col1 else 'OK!' END) as 'COL1'
,(case when tbl1.col2<>tbl2.col2 then ID+'TBL1:COL2:'+tbl2.col2+';TBL1:COL2:'+tbl2.col2 else 'OK!' END) as 'COL2'
,...
from tbl1,tbl2
where tbl1.id = tbl2.id

1,977

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 其他语言讨论
社区管理员
  • 其他语言社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧