title: Mysql 5.6.12 bug : error 1356 when using order by alias in a view definition
body: <p>I have a very simple Query, which works fine:</p>
  
  <pre><code>SELECT *
  FROM images i
  INNER JOIN v_images_stats s
  ON i.id = s.id
  </code></pre>
  
  <p>By <code>SELECT *</code> I end up creating duplicate column names so I edited the query to be more specific
  and ignore the duplicate column names but MySQL throws a #1356 error:</p>
  
  <pre><code>SELECT i.is as id, s.id as imageid
  FROM images i
  INNER JOIN v_images_stats s
  ON i.id = s.id
  </code></pre>
  
  <blockquote>
    <p>#1356 - View 'events.v_image_stats' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them</p>
  </blockquote>
  
  <p>The v_image_stats view and the underlying views and tables it is based have the correct privileges, I'm completely flummoxed.</p>
  
  <p>I'm using MySQL 5.6 and phpmyadmin to create and manage the views, I am also accessing the DB via PHP PDO within the Phalcon framework but I'm pretty sure this a MySQL issue rather than anything else.</p>
  
  <p>Any help gratefully received.</p>
  
  <p>I originally posted the full output of SHOW CREATE VIEW but it was too verbose, here is the simplest example I can create to recreate the problem:</p>
  
  <pre><code>CREATE ALGORITHM=UNDEFINED DEFINER=`events`@`localhost` SQL SECURITY DEFINER VIEW `v_image_stats` AS
  (
      select it.*, 1 AS `my_alias`
      from `v_image_totals` `it`
      order by `my_alias` asc)
  )
  </code></pre>
  
  <p>It also fails if I use a table instead of a view in the FROM clause.</p>