从存在语句中选择列
这是我上一个问题的后续问题:Optimization of an oracle query
我现在使用的查询如下
select t1.column1, t2.column2
from table1@dev t1
where exists
( select *
from table2@dev
where t2.column2 = t1.column1
and t2.column3 > 0
)
order by column1
但是问题是我无法从 t2
访问 column2
我收到错误
t2.column2 标识符无效
使用EXISTS
时是否可以访问该表中的列?
提前致谢
This is a follow-up to my previous question: Optimisation of an oracle query
I am now using the query as follows
select t1.column1, t2.column2
from table1@dev t1
where exists
( select *
from table2@dev
where t2.column2 = t1.column1
and t2.column3 > 0
)
order by column1
But the problem is I can't access column2
from t2
i'm getting the error
t2.column2 invalid identifier
Is it possible to access the column from this table when using EXISTS
?
Thanks in advance
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
![扫码二维码加入Web技术交流群](/public/img/jiaqun_03.jpg)
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Exists
(顾名思义)只是检查该事物是否存在,它不会返回超出存在谓词的真/假的任何数据,所以不,这是不可能的从exists
语句返回数据。要从多个表中选择某些内容,您需要将它们连接起来,如下所示:
Exists
(as the name implies) merely checks if that thing exists, it does not return any data beyond the true/false of the existence predicate, so no, it's not possible to return data from anexists
statement.To select something from multiple tables, you need to join them, like this: