Applying LIKE function on column

How can I in Teradata apply LIKE function on column name. I wrote the following code:

ON asa.column_1 LIKE '%sb.column_2%'

This is not returning the result I want sb.column is COLUMN (with varible values) and not the string I am trying to find.

Edit: Actually I am trying to find a substring in a string. Which function do I have to use and how?


'%sb.column_2%' searches for the string 'sb.column_2' within asa.column_1. You probably need

ON asa.column_1 LIKE '%' || sb.column_2 || '%'

You could also use

ON POSITION(sb.column_2 IN asa.column_1) > 0

But both will always result in a product join which will consume a lot of CPU unless at least one table has a low number of rows. Your DBA will definitely not like that :-)

This join probably indicates a bad datamodel, it should be fixed first thus avoiding bad joins like this.

Need Your Help

Use label in assembly from C

c gcc assembly nasm

I simply need a way to load the address of a label e.g. MyLabel: in e.g. 'src.asm' into a variable in e.g. 'src.c'. (These files will be linked together) I am using gcc and nasm to assemble these f...

Java String array: how do I check if the array has a value?

java arrays string compare

I'm making a program in java that will use a string array say: