站长网 百科 oracle10g – 如何使用“as”为oracle 10中的连接表设置别名

oracle10g – 如何使用“as”为oracle 10中的连接表设置别名

我写了这个,这是错误的语法,帮我修复它,我希望’T’是两个内连接的结果的别名. select T.id from table1 inner join table2 on table1.x = table2.y inner join table3 on table3.z = table1.w as T; 您无法直接命名连接的结果.一种选择是使用子查询: sel

我写了这个,这是错误的语法,帮我修复它,我希望’T’是两个内连接的结果的别名.

select T.id 
from table1 
  inner join table2 on table1.x = table2.y  
  inner join table3 on table3.z = table1.w as T;

您无法直接命名连接的结果.一种选择是使用子查询:

select T.id
from (
  select *
  from table1
  inner join table2 on table1.x = table2.y
  inner join table3 on table3.z = table1.w
) T

另一种选择是子查询因子分解:

with T as (
  select *
  from table1
  inner join table2 on table1.x = table2.y
  inner join table3 on table3.z = table1.w
)
select T.id
from T

本文来自网络,不代表站长网立场,转载请注明出处:https://www.zwzz.com.cn/html/baike/2021/0524/5597.html

作者: dawei

【声明】:站长网内容转载自互联网,其相关言论仅代表作者个人观点绝非权威,不代表本站立场。如您发现内容存在版权问题,请提交相关链接至邮箱:bqsm@foxmail.com,我们将及时予以处理。
联系我们

联系我们

0577-28828765

在线咨询: QQ交谈

邮箱: xwei067@foxmail.com

工作时间:周一至周五,9:00-17:30,节假日休息

返回顶部