title: MySQL only insert new row if combination of columns (which allow duplicates) is unique
body: <p>Since IF EXISTS isn't supported by MySQL I am struggling to think of the syntax for doing something like the following pseudo in MySQL:</p>
  
  <pre><code>IF ((select count(*) from table where col1='var1' AND col2='var2' AND col3='var3' AND col4='var4' AND col5='var5')&gt;0) then
      combination of vars exist in record - do a thing;
  ELSE
      combination of vars does not exist in record - insert record;
  END IF;
  </code></pre>
  
  <p>I should have thought CASE would suit this but for life of me I'm unable to think of the correct syntax. I'd use unique indexes but every one of the columns needs to allow duplicates, it's only a matching combination of all the columns that needs to be unique, not the fields themselves.</p>
  
  <p>I'm told using a composite key across all the columns would avoid duplicate inserts but from what I gather I need to use a different insert then.</p>
  
  <p>Short version: In MySQL, how do I insert new row only if an exact specified match of columns is not found in an existing row.</p>
  
  <p>Any advice or suggestions would be greatly appreciated.</p>