title: Why can't "SELECT DISTINCT 1 AS score ORDER BY score DESC;" work during creation of temporary table
body: <p>In MySQL, this portion of code works and produces a single row of '1' as value.</p>
  
  <pre><code>SELECT DISTINCT 1 AS score
  ORDER BY score DESC;
  </code></pre>
  
  <p>However, when I use it with creating temporary tables as in the one below:</p>
  
  <pre><code>DROP TEMPORARY TABLE IF EXISTS `testTable`;
  CREATE TEMPORARY TABLE `testTable`
  SELECT DISTINCT 1 AS score
  ORDER BY score DESC;
  </code></pre>
  
  <p>MySQL would say: 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 'order by score desc' at line 3</p>
  
  <p>Note that the code below works... the one without ORDER BY</p>
  
  <pre><code>DROP TEMPORARY TABLE IF EXISTS `testTable`;
  CREATE TEMPORARY TABLE `testTable`
  SELECT DISTINCT 1 AS score;
  </code></pre>
  
  <p>Appending it with a FROM clause as shown below, would work...</p>
  
  <pre><code>DROP TEMPORARY TABLE IF EXISTS `testTable`;
  CREATE TEMPORARY TABLE `testTable`
  SELECT DISTINCT 1 AS score
  FROM tableX
  ORDER BY score DESC;
  </code></pre>
  
  <p>I know that my sample above is not significant, but this is more of a curiosity question. Thanks.</p>