SELECT a.* FROM temp a, temp@OLD b WHERE a.temp_no = b.temp_no(+) AND b.temp_no IS NULL 显示存在a,但没有存在b的数据,我想你的问题主要是同时连接2个库的问题
--显示表1中有但表2中没有的数据 select * from 表1 minus select * from 表2--显示表2中有但表1中没有的数据 select * from 表2 minus select * from 表1--显示两个表中的不同数据 select * from 表1 minus select * from 表2 union select * from 表2 minus select * from 表1
minus 表示减去的意思.要用于相同的表结构或者查询的字段要相同.select * from 表1 where not exists(select 1 from 表2 where 表1.主键=表2.主键) union select * from 表2 where not exists(select 1 from 表1 where 表1.主键=表2.主键)注:在相同表结构的方式建议用minus 速度快
FROM temp a, temp@OLD b
WHERE a.temp_no = b.temp_no(+)
AND b.temp_no IS NULL 显示存在a,但没有存在b的数据,我想你的问题主要是同时连接2个库的问题
select * from 表1
minus
select * from 表2--显示表2中有但表1中没有的数据
select * from 表2
minus
select * from 表1--显示两个表中的不同数据
select * from 表1
minus
select * from 表2
union
select * from 表2
minus
select * from 表1
union
select * from 表2 where not exists(select 1 from 表1 where 表1.主键=表2.主键)注:在相同表结构的方式建议用minus 速度快