select * into t3 from
(select * from t1 where not exists(select 1 from t2 where t1.单位名称=t2.单位名称 and t1.姓名=t2.姓名 and t1.金额=t2.金额)
union
select * from t2 where not exists(select 1 from t1 where t1.单位名称=t2.单位名称 and t1.姓名=t2.姓名 and t1.金额=t2.金额) a
(select * from t1 where not exists(select 1 from t2 where t1.单位名称=t2.单位名称 and t1.姓名=t2.姓名 and t1.金额=t2.金额)
union
select * from t2 where not exists(select 1 from t1 where t1.单位名称=t2.单位名称 and t1.姓名=t2.姓名 and t1.金额=t2.金额) a
解决方案 »
- 一个数据库的问题,大虾们帮帮忙
- 查询追加?????
- xp下安装sql2008遇到问题
- java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]ResultSet can not re-read row data
- 求解2个sql语句 谢谢
- select Where id=? 时显示空值
- 简单问题,大家来拿分!!
- 紧急求助,在线急等,希望多多帮忙!
- 没有日志文件如何还原数据库,请帮忙!急!!
- 如何在sql server 中写一个存储过程,把表中的一些信息以http的post 方式发给一个服务器?
- 请诸位师兄推荐一本学习SQL语句的参考书吧!
- 我想设计设计一个表B,当输入id时,能从令一个表A读入name字段。(A有id,name这两个字段)
select * from 表1 where not exists (select 1 from 表2 where 表1.单位名称=表2.单位名称 and 表1.姓名=表2.姓名 and 表1.金额=表2.金额)
union all
select * from 表2 where not exists (select 1 from 表1 where 表1.单位名称=表2.单位名称 and 表1.姓名=表2.姓名 and 表1.金额=表2.金额) ) tem
select * from 新表
(select * from table1 as A where not exists
(select * from table2 where 单位名称=A.单位名称 and 姓名=A.姓名 and 金额=A.金额)
union all
select * from table2 as B where not exists
(select * from table1 where 单位名称=B.单位名称 and 姓名=B.姓名 and 金额=B.金额)
) C