我写了这个,这是错误的语法,帮我修复它,我希望’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