title: Using LOAD DATA INFILE statement when csv table headings don't match mySQL table headings?
body: <p>What I'm looking to do is import some <strong>.CSV</strong> files into <strong>mySQL</strong> using <strong>php</strong>.</p>
  
  <p>I'm going to be using the <strong>LOAD DATA INFILE</strong> statement but I have an issue:</p>
  
  <p>The headers in the .CSV file don't match up with the columns in the mySQL table, there are way more in the .CSV file. I know I can ignore certain columnhs by using a variable like:</p>
  
  <pre><code>$insert_query = "LOAD DATA LOCAL INFILE $csvfile
              INTO table $tableName
              FIELDS TERMINATED BY ','
              LINES TERMINATED BY ''
              (col1,col2,col3,@ignore,col4)";
  </code></pre>
  
  <p>What I would like to know is if I can assign the columns of data in the .CSV file to different columns in the mySQL table, E.G mapping the first column of data in the .CSV to the fifth column of the mySQL table, kind of like:</p>
  
  <pre><code>$insert_query = "LOAD DATA LOCAL INFILE $csvfile
              INTO table $tableName
              FIELDS TERMINATED BY ','
              LINES TERMINATED BY ''
              (col5,col2,col3,@ignore,col4)";
  </code></pre>
  
  <p>Is this possible? If so, some examples would be greatly appreciated! :)</p>
  
  <p>Thanks!</p>