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