I am trying to join tables where the only 2 keys which match are table1.Account
and table2.key
But the problem is the setup. The table1.Account
field has 10 digits and only the middle 4 or 5 digits match with the table2.key
eg : 1234xxxx10 - > table1.Account matches with xxxx -> table2.key
or 123xxxxx10 - > table1.Account matches with xxxxx -> table2.key
I've written this piece of INNER JOIN code but the query keeps on running and is not giving me back anything.
SELECT DISTINCT column1, column2
from table1 INNER JOIN table2 ON table1.Account like '%'+table2.key+'%'
order by column1