title: Transfer data from memory table to production one by criteria
body: <p>I wander around can I transfer the data gathered in memory table to actual one by sql query only.</p>
  <p>The two tables have the same structure and pk is products_id(int, AI)</p>
  <p>The problem is the criteria is completely different than the pk. The products are identified by 2 columns - barcode and company.</p>
  <p>So ignoring the pk in whole, I need to update the data if in actual table there is a row with the same barcode and company, and insert new record if there is none.</p>
  <p>Tried this:</p>
  <pre><code>INSERT INTO products (products_sku, ...)
  SELECT products_sku... FROM temp_products
  WHERE (temp_products.products_barcode = products.products_barcode) AND (temp_products.products_comp = products.products_comp)
  </code></pre>
  <p>But i dont have access in the select to products table so to make the filtering</p>