title: mysql selective product insert if not exist
body: <p>I would like to insert rows from one table <code>products</code> (table1) and column named <code>text</code> into a second table where the table doesn't have the same row values of the <code>text2</code> columns using (like) i am referring to the <code>wp_posts</code> (table2) table.</p>
  
  <p>First table: table1</p>
  
  <pre><code>id   |  text   
  -------------
  1       t1      
  2       t2           
  3       t3
  4       t4
  5       t5
  6       t6
  7       t7
  8       t8
  ....
  </code></pre>
  
  <p>Second table: table2</p>
  
  <pre><code>id  |   text2
  --------------
  1   t1
  2   t4
  3   t6 t62
  4   t8
  5   t9
  ...
  </code></pre>
  
  <p>Expected result after select:</p>
  
  <pre><code>id  |   text2
  --------------
  1   t2
  2   t3
  3   t5
  4   t7
  ...
  </code></pre>
  
  <p>this result i want to insert in table2  </p>
  
  <p>Expected result after insert in tabel2:</p>
  
  <pre><code>id   |  text   
  -------------
  1       t1      
  2       t2           
  3       t3
  4       t4
  5       t5
  6       t6 t62
  7       t7
  8       t8
  9       t9
  ....
  </code></pre>
  
  <p>and this result i want to inser in tabel 2 where these values are missing.</p>
  
  <p>I tried something like this, but because the data tables have a large amount of that in them, more then 180000 entries, this takes a long time:</p>
  
  <pre><code>INSERT INTO table2 (text2)
  SELECT t1.text, 
  FROM table1 t1
  JOIN table2 t2 ON t1.text LIKE CONCAT('%', t2.text2 ,'%')
  </code></pre>
  
  <p>Or how do i do something like this?:</p>
  
  <pre><code>SELECT text
  FROM tabel1
  WHERE NOT EXISTS (SELECT text2
                        FROM tabel2
                        WHERE text2 LIKE tabel1.text ????)
  </code></pre>
  
  <p>Or other idea to solve this problem?</p>