title: Select from one table where not in another
body: <p>I'm trying to find the rows that are in one table but not another, both tables are in different databases and also have different column names on the column that I'm using to match.</p>
  
  <p>I've got a query, code below, and I think it probably works but it's way too slow:</p>
  
  <pre><code>SELECT `pm`.`id`
  FROM `R2R`.`partmaster` `pm`
  WHERE NOT EXISTS (
      SELECT * 
      FROM `wpsapi4`.`product_details` `pd`
      WHERE `pm`.`id` = `pd`.`part_num`
  )
  </code></pre>
  
  <p>So the query is trying to do as follows:</p>
  
  <p>Select all the ids from the R2R.partmaster database that are not in the wpsapi4.product_details database. The columns I'm matching are partmaster.id &amp; product_details.part_num</p>