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

前端之家收集整理的这篇文章主要介绍了oracle10g – 如何使用“as”为oracle 10中的连接表设置别名前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我写了这个,这是错误的语法,帮我修复它,我希望’T’是两个内连接的结果的别名.
  1. select T.id
  2. from table1
  3. inner join table2 on table1.x = table2.y
  4. inner join table3 on table3.z = table1.w as T;
您无法直接命名连接的结果.一种选择是使用子查询
  1. select T.id
  2. from (
  3. select *
  4. from table1
  5. inner join table2 on table1.x = table2.y
  6. inner join table3 on table3.z = table1.w
  7. ) T

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

  1. with T as (
  2. select *
  3. from table1
  4. inner join table2 on table1.x = table2.y
  5. inner join table3 on table3.z = table1.w
  6. )
  7. select T.id
  8. from T

猜你在找的Oracle相关文章