Note that there are some explanatory texts on larger screens.

plurals
  1. POCompare the values of two mysql tables
    primarykey
    data
    text
    <p>I have a table called <code>mainlinks</code> which has about six million rows. There's a column called <code>url</code> which holds url's from the web, and two more columns called <code>metaTitle</code> and <code>metaDesc</code> which are empty on most rows.</p> <p>I have another table called <code>links1</code> which has about 3.5 million rows, with columns <code>URL</code>, <code>Utitle</code> and <code>metaDesc</code>. All the URL's in <code>links1</code> are also in <code>mainlinks</code>. <code>Links1</code> has several million url's which have titles and meta:descriptions in their <code>Utitle</code> and <code>metaDesc</code> columns. I'm now trying to get SQL to compare the two tables, and where-ever <code>links1</code> has a title and description for a URL, to copy that information to <code>metaTitle</code> and <code>metaDesc</code> in <code>mainlinks</code>.</p> <p>I tried the following code:</p> <pre><code>UPDATE mainlinks INNER JOIN links1 ON (mainlinks.URL = links1.URL) SET mainlinks.metaTitle = links1.UTitle, mainlinks.metaDesc = links1.metaDesc </code></pre> <p>Phpmyadmin told me that several hundred records were updated, although I know for a fact that it should be several million. Just doing a quick browse through the two tables showed, for example, "<a href="https://zvelo.com" rel="nofollow">https://zvelo.com</a>" in both <code>URL</code> columns, but the values in the <code>Utitle</code> and <code>metaDesc</code> columns didn't get copied over to <code>mainlinks</code>. Any idea what the problem could be?</p> <p>TIA!</p> <p>EDIT: Could it maybe be that one of the URL columns has some whitespace after the actual url which the other one doesn't have, and that they are therefore seen as different? If yes, how could I get around this?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload