title: MySQL column value in LIKE query
body: <p>I have two tables in a database.</p>
  
  <p>Both contain a related id but in a different format:</p>
  
  <pre><code>table1.field = 123456-12-34
  table2.id = 123456
  </code></pre>
  
  <p>What Im trying to do is  a <code>join</code> on <code>table1.id = table2.field</code></p>
  
  <p>so the query looks like:</p>
  
  <pre><code>select name from 
      table1 left join table2 on table1.field like table2-%
      where table2.flag='1' and DATEDIFF( now(), table1.timestamp ) &gt; 2
  </code></pre>
  
  <p>I know this isn't correct, but how do i join two tables on fields where they are related but not the same?</p>