Skip to content
Advertisement

Conditionally joining from multiple tables

Does SQL allow some form of conditional “table choosing” within the Join statement? ie. selecting a different table to join based on a predefined variable/condition.

The error I get when attempting this method is ORA-00905: missing keyword.

Advertisement

Answer

No. Neither SQL nor Oracle allow this, unless you use dynamic SQL.

Assuming the tables have the same columns, you could write this logic as:

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement