MSCEWI1054

Unsupported outer join subquery

triangle-exclamation

Severity

Low

Description

This error happens when a correlated subquery is found within an OR logical expression of an OUTER JOIN (Left, Right or Full). In those cases they could produce inconsistent results or cause the following error:

SQL compilation error: Unsupported subquery type cannot be evaluated.

These limitations with subqueries are briefly mentioned in Snowflake documentationarrow-up-right and some information about them can also be found in Snowflake forums.arrow-up-right

Example code

Input Code (Teradata):

SELECT a.Column1, b.Column2
FROM
Table1 a
LEFT JOIN Table2 b
ON (a.Column1 = b.Column1)
AND (a.Column2 = b.Column2 OR EXISTS(SELECT * 
                                     FROM Table3 c
                                     WHERE c.Column1 = a.Column1));

Output Code:

Recommendations

  • Verify the output code does not produce a compilation error.

  • Verify the output code's functional equivalence.

  • If you need more support, you can email us at [email protected]envelope

Last updated