title: Select from same table as an Insert or Update
body: <p>Clearly the following is incorrect.</p>
  
  <pre><code>INSERT INTO `aTable` (`A`,`B`) VALUES((SELECT MAX(`A`) FROM `aTable`)*2),'name');
  </code></pre>
  
  <p>I get the value:</p>
  
  <p>SQL query: </p>
  
  <pre><code>INSERT INTO `aTable` (`A`, `B` )
  VALUES 
  (
    (
     SELECT MAX(`A`)
     FROM `aTable`
    ) *2
   , 'name'
  )
  </code></pre>
  
  <p>MySQL said:</p>
  
  <p>1093 - You can't specify target table 'aTable' for update in FROM clause </p>
  
  <p>So, I'm trying to make a bitmap table, each row corresponds to one Bit, and has a 'map' value.</p>
  
  <p>To insert in the table, I don't want to do two queries, I want to do one.
  How should I do this?</p>
  
  <p>No one commented on this, but since I am trying to make a bitmap, it should be * 2 not ^ 2, my mistake, please note that is why the comments often say ^ 2, it was an error in the version that the commenters read.</p>