title: Find a word of a column in another column and replace?
body: <p>this is the first time I'm posting here! Hope to get a good reply.</p>
  
  <p>I have two table, and based on the path I need to locate and replace with '' the name of table2 in the name of table1.</p>
  
  <pre><code>table1
  +---------------+----------+
  | name          | path     |
  +---------------+----------+
  | John Smith    | 12345    |
  +---------------+----------+
  | John Smith    | 54321    |
  +---------------+----------+
  | JohnSmith     | 12345    |
  +---------------+----------+
  
  table2
  +---------------+----------+
  | name          | path     |
  +---------------+----------+
  | John          | 12345    |
  +---------------+----------+
  | Smith         | 54321    |
  +---------------+----------+
  
  the final result would be like
  +---------------+----------+
  | name          | path     |
  +---------------+----------+
  | Smith         | 12345    |
  +---------------+----------+
  | John          | 54321    |
  +---------------+----------+
  | JohnSmith     | 12345    |
  +---------------+----------+
  </code></pre>
  
  <p>as you can see I need to replace only the exact match. So in JohnSmith I don't remove John.</p>
  
  <p>The question is also, do I do it only with a mysql query? Or some php is also needed for something like that?</p>
  
  <p>Thank you in advance.</p>
  
  <hr>
  
  <p>both queries are close, but don't give exactly what I need as an output.</p>
  
  <p>e.g. the first one produce</p>
  
  <pre><code>NAME        PATH
  Smith       12345
  John        54321
  Smith       12345
  </code></pre>
  
  <p>here the last row, should not be changes. As we don't have any exact match. and the row should stay the same "JohnSmith"</p>
  
  <p>in the second one, the output is </p>
  
  <pre><code>NAME        PATH
  Smith       12345
  John Smith  54321
  JohnSmith   12345
  </code></pre>
  
  <p>here the second line seems wrong, as it should remove "Smith"</p>
  
  <p>any idea ?</p>