title: how to join, if the text contains
body: <p>I have 2 tables, say table A has 10 rows and table B has 100 rows and I want to perform a join, but the matching condition has to be where a column from A 'is like' a column from B meaning that anything can come before or after the column in B:</p>
  
  <p>For example: if the column in A is 'foo'. Then the join would match if column in B is either: 'fooblah', 'somethingfooblah', or just 'foo'. I know how to use the wildcards in a standard like statement, but am confused when doing a join. Does this make sense? Thanks.</p>
  
  <p>This Code doesn't work: </p>
  
  <pre><code>SELECT *
  FROM TABLE a JOIN
       TABLE b
       ON b.column LIKE CONCAT('%', a.column, '%');
  </code></pre>
  
  <p>Example: </p>
  
  <pre><code>Table A
  +-------+
  | MYCOL | 
  +-------+
  | foo   |
  | foo   |
  | bar   |
  | bbb   |
  | bar   |
  +-------+
  
  Table B
  +------------------+
  | MYCOL            |
  +------------------+
  | fooblah          |
  | somethingfooblah |
  | foo              |
  | barblah          |
  | somethingbarblah |
  | bar              |
  +------------------+
  
  Result:
  +-------+------------------+
  | MYCOL | MYCOL            |
  +-------+------------------+
  | foo   | fooblah          |
  | foo   | somethingfooblah |
  | foo   | foo              |
  | --    | test             |
  | bar   | somethingbarblah |
  | bar   | bar              |
  +-------+------------------+
  </code></pre>