Oracle:在另一个子查询中使用一个子查询的结果

发布于 2024-12-03 04:16:00 字数 306 浏览 1 评论 0原文

select t1Joint2.c1,t1Joint3.c3 from
(select * from table1 where name  = "some") t1,
(select t1.c1,t2.c2 from table2 t2 where t1.c1 = t2.c2) t1Joint2,
(select t1.c1,t3.c3 from table3 t3 where t1.c1 = t3.c3) t1Joint3,
;

上述查询在 Oracle 中不起作用。
有什么解决办法吗?

使用Oracle 11g。

select t1Joint2.c1,t1Joint3.c3 from
(select * from table1 where name  = "some") t1,
(select t1.c1,t2.c2 from table2 t2 where t1.c1 = t2.c2) t1Joint2,
(select t1.c1,t3.c3 from table3 t3 where t1.c1 = t3.c3) t1Joint3,
;

The above query doesn't work in Oracle.
Any workaround?

Using Oracle 11g.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

恬淡成诗 2024-12-10 04:16:00

为什么不写成:

select t1.c1, t3.c3
from table1 t1
join table2 t2 on t1.c1 = t2.c2
join table3 t3 on t1.c1 = t3.c3
where name = "some"

Why not write it as:

select t1.c1, t3.c3
from table1 t1
join table2 t2 on t1.c1 = t2.c2
join table3 t3 on t1.c1 = t3.c3
where name = "some"
糖粟与秋泊 2024-12-10 04:16:00
with t1 as 
  (select * from table1 where name  = 'some')
, t1Joint2 as
  (select t1.c1,t2.c2 from t1,  table2 t2 where t1.c1 = t2.c2)
, t1Joint3 as
  (select t1.c1, t3.c3 from t1, table3 t3 where t1.c1 = t3.c3) 
select t1Joint2.c1,t1Joint3.c3 
from t1Joint2, t1Joint3
;
with t1 as 
  (select * from table1 where name  = 'some')
, t1Joint2 as
  (select t1.c1,t2.c2 from t1,  table2 t2 where t1.c1 = t2.c2)
, t1Joint3 as
  (select t1.c1, t3.c3 from t1, table3 t3 where t1.c1 = t3.c3) 
select t1Joint2.c1,t1Joint3.c3 
from t1Joint2, t1Joint3
;
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文