查询表A中存在,而表B中不存在的记录 表A中有如下字段
aid aname adate atotal
001 aa 20100701 500
002 ab 20100702 400
003 ac 20100703 130
004 ad 20100704 30
005 a3 20100705 20 表B中有如下字段
aid aname adate atotal
001 aa 20100701 100
002 ab 20100702 100
003 ac 20100703 100
008 ad 20100704 100
006 a3 20100705 100根据 id 和 date 查询 如果 表A中的记录 在表B中不存在,
则,查询出A记录。。
aid aname adate atotal
001 aa 20100701 500
002 ab 20100702 400
003 ac 20100703 130
004 ad 20100704 30
005 a3 20100705 20 表B中有如下字段
aid aname adate atotal
001 aa 20100701 100
002 ab 20100702 100
003 ac 20100703 100
008 ad 20100704 100
006 a3 20100705 100根据 id 和 date 查询 如果 表A中的记录 在表B中不存在,
则,查询出A记录。。
解决方案 »
- 连接数据库提示oracle initialization or shutdown in process
- 关于过程的问题
- 问下Inthirties,一个存储过程里面如何假如alter table 之类的ddl语句?
- Oracl 触发器的问题!
- 出现错误:java.sql.SQLException: ORA-01830: 日期格式图片在转换整个输入字符串之前结束
- 如何远程备份oracle数据库到本地 ?
- ora-01652 无法通过128(在表空间TEMP中)扩展temp段
- 向各位高手请教一个问题!!!我在线等后。谢谢!
- CSDN 广告无所不在?
- 求oracle9i电子书籍下载地址!
- 求oracle K-MEANS算法
- 请问如何从一个数据库中取的数据存入另一个数据库
select a.aid, a.aname, a.adate, a.atotal
from a
minus
select b.aid, b.aname, b.adate, b.atotal
from b;-- 2: 用not exists
select a.aid, a.aname, a.adate, a.atotal
from a
where not exists (select 1 from b
where b.aid=a.aid
and b.aname=a.aname
and b.adate=a.adate
and b.atotal=a.atotal );
select * from a where (aid,adate) in(
select a.aid, a.adate
from a
minus
select b.aid,b.adate
from b);
select a.aid, a.aname, a.adate, a.atotal
from a
where a.aid not in(select b.aid from b
where b.aid=a.aid
and b.aname=a.aname
and b.adate=a.adate
and b.atotal=a.atotal );