我在基于表名的on子句加入两个联合集。表名只是前缀不同但它似乎不起作用。我正在使用Teradata。
有什么想法吗?
SELECT a.TableName, b.TableName,
FROM
(SELECT abc as TableName FROM db.abc UNION
SELECT def as TableName FROM db.2) AS def
FULL OUTER JOIN
(SELECT ghi as TableName FROM db2.ghi UNION
SELECT lmn as TableName FROM db3.lmn) AS b
ON ','||b.TABLENAME||',' LIKE '%,' ||TRIM(a.TABLENAME)||', %';