title: SQL Update Text from another Table
body: <p>this is my first question to S.O. so plz forgive the noobiness. Im also not that crash hot with SQL so I appreciate any advice on this. </p>
  
  <p>I have on table <em>wp_6_posts</em> which has column named <em>post_content</em> and in that column on various rows is a text string with format:</p>
  
  <pre><code>http://www.domain.com/52
  http://www.domain.com/182
  http://www.domain.com/122
  </code></pre>
  
  <p>In another table <em>wp_6_pmlca_links</em> there are rows with ID numbers that match the numbers at the end of the URl above.  Also in that table is the column <em>afflink</em> which contains the URL I need (it is the only content in that field).</p>
  
  <p>What I need to do is replace the entire first URL in <em>post_content</em> with the URL from the corresponding <em>afflink</em> row.</p>
  
  <p>Any/all advice is greatly appreciated.</p>
  
  <p>EDIT:</p>
  
  <p>For example, currently the <em>post_content</em> column contains the text of the post for that row.  It can be several thousand characters long, but within it will be either 1, or a number of URLS with the synatx above, usually in a href tag:</p>
  
  <pre><code>Text here to &lt;a href="http://www.domain.com/23"&gt;Text for link&lt;/a&gt;
  </code></pre>
  
  <p>The link that corresponds to the number in the URL is stored in a separate table as mentioned above.  The row structure for that is:</p>
  
  <pre><code>ID | slug | URL |
  ----------------
  23 |  23  | http://www.externaldomain.com/link |
  </code></pre>
  
  <p>What I need to do is identify the first URL, query to find the corresponding URL and the replace the first URL with the second. </p>
  
  <p>I have no idea what SQL syntax to use to construct the query Im sorry :( </p>