title: Re-writing my query to delete from a select statement
body: <p>Here's my query which in theory would be what I want but I know that MySQL won't let you use the same table in the sub-select as in the delete:</p>
  
  <pre><code>DELETE FROM manifestPallet WHERE palletID IN 
  ( SELECT  manifestPallet.palletID 
              FROM manifestPallet
              LEFT JOIN manifestBox
              ON manifestPallet.palletID = manifestBox.palletID
              WHERE manifestBox.palletID IS NULL)
  </code></pre>
  
  <p><strong>I know I can do the select first, then loop through the results in my php script and do delete queries but I think there is probably a more elegant solution using pure MySQL.</strong> </p>
  
  <p>Extra info:
  What the query does is delete pallets from a manifest that are empty. A user creates pallets then places boxes on them, if they create a pallet but don't put any boxes on it then the pallet needs to be removed when the manifest is closed. </p>