5
我寫了這個,它的語法是錯誤的,幫助我修復它,我想'T'是兩個內部連接的結果的別名。如何在oracle中使用「as」設置連接表的別名10
select T.id
from table1
inner join table2 on table1.x = table2.y
inner join table3 on table3.z = table1.w as T;
我寫了這個,它的語法是錯誤的,幫助我修復它,我想'T'是兩個內部連接的結果的別名。如何在oracle中使用「as」設置連接表的別名10
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
不能使用別名命名「整個」加入,你可以,但是,放在各個表的別名的加入:
select t1.id
from table1 t1
inner join table2 t2 on t1.x = t2.y
inner join table3 t3 on t3.z = t1.w
在投影,你將不得不使用表,它定義了id
列你要select
的別名。