title: INSERT, DELETE, UPDATE in one query
body: <p>I have following table</p>
  <pre><code>id  val     match_id    oddname_id    dif
  1   1.75    401             1         0.25 //THIS ONE MUST BE DELETED. EXPLAINED BELOW
  2   3.30    401             2         -0.20
  3   5.00    401             3         0.00
  4   1.13    401             4         0.00
  </code></pre>
  <p>Id is just index. And primary key is <strong>oddname_id</strong> and <strong>match_id</strong> together.</p>
  <p>I parse data from xml and here is what I must to do:</p>
  <ol>
  <li><p>INSERT if PRIMARY KEY NOT EXISTS.</p>
  <p>When I have match_id=402 and oddname_id=1 I must insert, because match_id 402 doesn't exists.</p>
  </li>
  <li><p>ON DUPLICATE KEY UPDATE.</p>
  <p>When I have match_id=401 and oddname_id=1 i must update only val and dif. (dif equals difference of val and it's new value.</p>
  </li>
  <li><p>I want to delete all data if KEY DOESN'T EXISTS</p>
  </li>
  </ol>
  <p>Here's my query; first two statements works fine, but I have no opinion how I'll make 3rd one to work:</p>
  <pre><code>INSERT INTO odds 
      (match_id,oddname_id,val) 
  VALUES 
      ('401','2','3.3'),
      ('401','3','5.0'),
      ('401','4','1.25'),
  ON DUPLICATE KEY 
  UPDATE 
      dif = val-VALUES(val), 
      val = VALUES(val);
  </code></pre>
  <p>I Want to add to this query something like this:</p>
  <pre><code>IF KEY DOESN'T EXISTS DELETE.
  </code></pre>
  <p>in this example it must delete first row:</p>
  <pre><code> id val     match_id    oddname_id    dif
   1  1.75    401             1         0.25
  </code></pre>
  <p>Because I have not 401 (match_id) and 1 (oddname_id) in VALUES while inserting.</p>