Joining on derived column which is derived in the same view

Database

Joining on derived column which is derived in the same view

Hi,

I need some alternate way of joining two tables on derived column.

Right now I am deriving a column and giving it some name and using this as an element to join to another table.

This table needs to be joined on derived column to get its corresponding code key.

For Eg:

Sel 

case when claim_cd='A'

then XYZ||ABC end as dervd_col ,

B.code_key

from table1 A

left outer join table2 B on dervd_col=B.column

Is there any alternate way of coding this piece? There are already some sub queries in the view hence when I join on the derived column it is running into prod joins and finally running out of spool.

Hoping to recieve some help,

Thanks!

1 REPLY
Teradata Employee

Re: Joining on derived column which is derived in the same view

Derived tables and string operations usually end up in product join, what you can do is perhaps store a value of a derived column in a table and then use it as it is.

HTH!