当前位置: 代码迷 >> Sql Server >> 两个表相同,查询有关问题
  详细解决方案

两个表相同,查询有关问题

热度:58   发布时间:2016-04-24 10:46:56.0
两个表相同,查询问题
table A  table B
table A
djbh,   shl,   je,   name,    he
123       1      2        test       1
124       2      3         test1    1
 table b
xgdjbh ,djbh,      shl,  je,    name   he
q123     123         1     2         test      1


如何查询量表不相同的结果
djbh      shl      je     name      he
1234     2        3          test1    1
------解决方案--------------------

  
select * from tableA a where not exists(
select * from tableB where a.djbh=b.djbh and a.shi=b.shi
and a.je=b.je and a.name=b.name and a.he=b.he  
)
  相关解决方案