你可以这样试一下:
select distinct a.asker,b.name,c.nsrh from note a,nsr b where a.asker=b.nsrh;
select distinct a.asker,b.name,c.nsrh from note a,nsr b where a.asker=b.nsrh;
解决方案 »
- 不明白,大家看看我这个包有什么错,编译通过可就是之行报错.在线等....
- 为什么从表中取出来的值(float)在表中找不到与它相等的值?(表中类型为number)
- 这一段时间没来了,发现突然长了三个星星,:) 祝大家元旦快乐!
- 通过DBLINK查询占用谁的资源?
- to_date函数的问题,急!!!
- Oracle 中的字段替换
- VC中通过ADO调用ORACLE带ref cursor的存储过程为何返回ORA-24338错误?
- Oracle中如何得到某个用户所拥有的全部表名?
- 将一个图片文件保存到ORACLE,必须同时使用BFILE和BLOB吗?
- 请教条件查询问题
- 在存储过程中是否可以定义数组, 如果可以, 如何定义?
- 两个问题!!
select note.asker from nsr,operator where note.id=nsr.nsrh or note.id=operator.operatirid;
union
select operator.name from operator,note where operator.operatorid=note.asker;
select nsr.name from nsr,note where nsr.nsrh=note.asker and note.asker=指定的asker
union
select operator.name from operator,note where operator.operatorid=note.asker and note.asker=指定的asker;
你只关联了一个表
TO:BlueskyWide(谈趣者)
你显示的结果不是我想要的举列:
note:1
2
3
--------------------
ask: 1 ab
2 bc
--------------------
operator: 3 cd
---------------------
我想要的结果是
name
ab
bc
cd
或者
ask.name operator.name
ab
bc
cd
select (select name from nsr where nsrh=asker) nname,(select name from operator where operatorid=asker) oname from note;以下另一种效果:
select name from nsr where exists(select 1 from note where nsrh=asker)
union
select name from operator where exists(select 1 from note where operatorid=asker)
where note.asker=ask.nsrh(+) and note.asker=operator.operatorid(+)
你的第2中方法可以实现我要的第2种效果
第一种的结果是把重复的都过滤调了
我希望是
note:1
2
2
2
3
--------------------
ask: 1 ab
2 bc
--------------------
operator: 3 cd
---------------------
我想要的结果是
name
ab
bc
bc
bc
cd
union
select operator.name name from operator,note where operator.operatorid=note.asker;
union all
select operator.name from operator,note where operator.operatorid=note.asker;