title: MySQL how to cross check a single cell of a table, against the entire column of another table?
body: <p>I have two tables.  They are as follows:</p>
  <p>TABLE1
  Table1 is the dictionary table:</p>
  <pre><code>word
  ------
  apple
  orange
  banana
  pear
  guava
  cherry
  peach
  </code></pre>
  <p>TABLE2
  Table2 is the setence table:</p>
  <pre><code>id | sentence
  ---+----------
  1  | john loves apple and orange
  2  | jane prefers bananna, CARROT and pear
  .  | ..
  .  | ...
  9  | peter likes guava, WATER MELON, CELERY and pear
  </code></pre>
  <p>DESIRED RETURN RESULTS
  I would like to run for example id=2 row of table2, against <strong>every row</strong> of table1 such that the query returns:</p>
  <pre><code>banana
  pear
  </code></pre>
  <p>Or if I run id=9 row of table2 against table1, then the return result should be:</p>
  <pre><code>guava
  pear
  </code></pre>
  <p>SQL QUERY I HAVE TRIED SO FAR (AND FAILED)</p>
  <pre><code>SELECT word 
  FROM table1 
  WHERE SUBSTRING( word ,  (SELECT sentence FROM table2 WHERE id=2 ) );
  </code></pre>
  <p>This returned an empty set</p>
  <pre><code>SELECT word 
  FROM table1 
  WHERE SUBSTRING( word ,  (SELECT sentence FROM table2 WHERE id=2 ) )&gt;0;
  </code></pre>
  <p>This returned an empty set also</p>