title: MYSQL select * plus one column again
body: <p>Some SQL toolsets like PDO can do special things based on the first column selected, such as take it as class name to instantiate or to use it as key into a hashtable. Unfortunately PDO removes that column from the result. What if I still want it to be part of the result?</p>
  
  <p>I've tried queries such as </p>
  
  <pre><code>SELECT `class` as `myclass`, * FROM `mytable`
  </code></pre>
  
  <p>but I'm getting errors:</p>
  
  <blockquote>
    <p>#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '* FROM <code>mytable</code> at line 1</p>
  </blockquote>
  
  <p>I understand that there can't be conflicts in column names, hence the </p>
  
  <pre><code>as `myclass`
  </code></pre>
  
  <p>And the following works just fine:</p>
  
  <pre><code>SELECT `class` as `myclass`, `class` FROM `mytable`
  </code></pre>
  
  <p>Is this possible at all without doing a self-join or putting the full list of columns?</p>