Can you join using wild cards col_a like %col_b%

Database
Enthusiast

Can you join using wild cards col_a like %col_b%

I know you can use wild cards in your where clause to filter results but how can you join on them?  IE: I have 2 tables

Table1 column = 'Teradata is great'

Table2 column = 'data'

How can I get these 2 tables to join?  I know you could substring it out but I need to to work similar to a like clause.

Thanks!

3 REPLIES
Senior Supporter

Re: Can you join using wild cards col_a like %col_b%

try 

cards col_a like '%' || col_b || '%'

Junior Contributor

Re: Can you join using wild cards col_a like %col_b%

Just a remark:

When you join like this, you'll always get a product join and you got a really strange data model.

Dieter 

Senior Supporter

Re: Can you join using wild cards col_a like %col_b%

Strange data model: Depends on the use case. 

Can be very sufficient for specific problems. For example data quality checks ELT processes. Filter out email addresses containing specific pattern or domains etc. 

Or I used it for very flexible filter rules with multiple columns where not all have to be fully specifed all the time...

True that this is a product join but still quite efficient. But fully agree that this should never be a standard join on normal table.

Ulrich