title: MySQL INSERT INTO SELECT into a table with AUTO_INCREMENT
body: <p>Consider the following table:</p>
  
  <pre><code>CREATE TABLE `FooAttachments` (
   `AttachmentId` bigint(20) NOT NULL AUTO_INCREMENT,
   `FooId` bigint(20) NOT NULL,
   `AttachmentPath` varchar(100) NOT NULL,
   PRIMARY KEY (`AttachmentId`),
   KEY `IX_FooAttachment_FooBase` (`FooId`)
  ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf16
  </code></pre>
  
  <p>If I insert a row into this table using the following statement, a row is created and the AI field has a value generated.</p>
  
  <pre><code>INSERT INTO FooAttachments (FooId, AttachmentPath) VALUES (1, 'test path');
  </code></pre>
  
  <p>However, when I try to use an INSERT INTO SELECT statement as follows, I get an error:</p>
  
  <pre><code>INSERT INTO FooAttachments
      SELECT 1 AS FooId, 'test path' as AttachmentPath;
  </code></pre>
  
  <p>The error I get is: #1136 - Column count doesn't match value count at row 1 </p>
  
  <p>I understand that I'm not specifying the AttachmentId column, but I'm not doing so in the INSERT INTO ... VALUES statement either and that one works. More to the point, I don't want to specify a value for that column, it is supposed to be auto-generated.</p>
  
  <p>How should I write this second query?</p>