select * from tableA where caid=( select caid from tableB where wtforagent<=20) order by bgtime asc;请教如何在Oracle实现以上效果,从表tableB中select出符合条件的caid(多个值),然后从tableB中select出对应caid的各条记录...thx everyone ^.^
解决方案 »
- oracle imp 可以导入网络文件吗?
- 导出导入,clob的问题。
- oracle9.2装不上 CPU P4*2 内存1G????????
- 求助:database buffer cache中keep cache 和recycle cache的区别?一直没搞明白recycle cache的意思。请高手指点。
- 请问ORACLE 9i可以在WIN200Pro下安装吗?
- 急请教PROCEDURE高手,在Object Browser里,我这个PROCEDURE为何总是建立不成?
- 多谢 xzou(亡狼补齿)老兄,连接速度慢,15秒才能连上Oracle9i问题已解决。
- 寻找在hp unix上安装oracle8.1.7的步骤,高分相谢!
- oracle设置问题,非高手莫入????在线等待,急 急 急 急
- 克隆 跑脚本 报ora-17629:ora-01017
- PL/SQL顺时针输出 n 的平方个数字
- Oracle数据备份语句
select * from tableA where caid in( select caid from tableB where wtforagent<=20) order by bgtime asc;
select * from tableA t where exists( select 1 from tableB where t.caid=caid wtforagent<=20) order by bgtime asc;
用等于的话,把caid限制成了一个值,把等于改成in就行
select * from tableA where caid in( select caid from tableB where wtforagent<=20) order by bgtime asc;
select * from tableA a ,
( select caid from tableB where wtforagent<=20) b
where a.caid = b.caid order by bgtime asc;
select * from tableA t where exists
( select 1 from tableB where t.caid=caid and wtforagent<=20)
order by bgtime asc; select * from tableA where caid in
( select caid from tableB where wtforagent<=20)
order by bgtime asc;
这两种都能达到你要的效果,
如果表中的数据不是很大话,两种任意选一种。
但是数据量大的话,推荐第一种。
select * from tableA t where exists
( select 1 from tableB where t.caid=caid and wtforagent<=20)
order by bgtime asc;个人喜欢用exists
have a nice weekend~!