title: MYSQL Multi Table Delete
body: <p>I have 2 tables setup like this:</p>
  
  <pre><code>Items:
     id (int)
     name (varchar)
     category (int)
     last_update (timestamp)
  
  Categories
     id (int)
     name (varchar)
     tree_id (int)
  </code></pre>
  
  <p>I want to delete all the records from <code>Items</code>, who's <code>last_update</code> is NOT today, and who's corresponding <code>categories.tree_id</code> is equal to 1.  However, I don't want to delete anything from the <code>Categories</code> table, just the <code>Items</code> table.  I tried this:</p>
  
  <pre><code>$query = "DELETE FROM items USING categories, items
      WHERE items.category = categories.id
      AND categories.tree_id = 1
      AND items.last_update != '".date('Y-m-d')."'";
  </code></pre>
  
  <p>However this just seems to delete EVERY record who's <code>tree_id</code> is 1.  It should keep items with a <code>tree_id</code> of 1, as long as their <code>last_update</code> field is <code>today</code></p>
  
  <p>What am I missing?</p>