title: update and set value with max()+1 problems
body: <p>I am trying to update a row and set the shipment_number with <code>max()+1</code>. The reason for this is the table already has a <code>auto_increment</code> on another column named id. From the first query i'm getting the <code>max(shipment_number)</code> and in the next query iam incrementing with <code>+1</code>. But iam getting an error.. </p>
  
  <blockquote>
    <p>#1093 - You can't specify target table 'commercial_sales_custpo_process' for update in FROM clause</p>
  </blockquote>
  
  <p>Anyone pls help me with this query.</p>
  
  <pre><code>$max = "SELECT MAX(shipment_number) FROM commercial_sales_custpo_process WHERE 
  tender_id='$tender_id' AND id='$id'";
  
  $query1="UPDATE commercial_sales_custpo_process set shipment_number = ($max+1) WHERE 
  tender_id='$tender_id' AND id='$id'";
  mysql_query($query1) or die ("Error in query: $query1");
  </code></pre>