Skip to main content

I have two tables that I want to try a "relationship" with instead of a hard SQL JOIN command.

 

Table1 has a string of data that might be found somewhere in Table2's string. It might be in the middle, at the beginning, at the end or not at all.

 

My JOIN statement looks like:

 

RIGHT OUTER JOIN Table2 on (Table2.FullString like '%' + Table1.String + '%')

 

This way it keeps all the stuff in Table1 but only keeps the stuff that it matches in Table2 (if any).

 

Here's an example - it's a file path for a network share:

 

Table1.String = "Folder1/Folder2"

 

Table2.FullString examples:

"filer1:/vol/Folder1/File2" - should not match

"filer1:/vol/Folder1/Folder2/File1" - SHOULD match

"filer2:/Folder1/Folder2" - SHOULD also match

6 answers
  1. Dec 2, 2021, 6:42 PM

    Hi @Scott Walker​ -

    Remember, you will need to make a full cartesian relationships. Here in the example below I just set to 1 = 1. It should not matter which side the table is at. Take a look at the model attached for your reference.

    Hi @Scott Walker​ -Remember, you will need to make a full cartesian relationships. Here in the example below I just set to 1 = 1. It should not matter which side the table is at.

0/9000