0

在下面的 teradata SQL 代码中,我想将表 A (col1、col2、col3)中的 3 个不同列与员工表的名称列连接起来。下面的操作工作正常,但想在一个联接中执行此操作, 我们可以用替代方法来避免同一张表上的多个联接吗?由于视图的多次连接,我收到了假脱机空间错误。

Select (case when P.name is not null then A.col1 else null end)name1,
       (case when Q.name is not null then A.col2 else null end)name2,
       (case when R.name is not null then A.col3 else null end)name3
From A Left join
     employee P
     on P.name = A.col1 Left join
     employee Q
     on Q.name = A.col2 Left join
     employee R on R.name = A.col3
4

0 回答 0