title: Different MySQL versions give different result for LEFT JOIN and ORDER in subquery
body: <p>Since migrating to MySQL 5.6 i'm having trouble with the order of a joined table.
  This worked fine in MySQL 5.1</p>
  
  <p>I want to select every last single picture (highest id) for every category in product_cat_pictures. On every execution of this same query, the order of the pictures for specific categories is different.</p>
  
  <pre><code>SELECT c.id, repo.filename FROM product_cat_container AS c
  LEFT JOIN (SELECT * FROM product_cat_pictures ORDER BY id DESC) AS p
    ON c.id = p.cat_id
  LEFT JOIN picture_repository AS repo
    ON p.picture_id = repo.id
  GROUP BY c.id
  ORDER BY c.order
  
  
  product_cat_container
  ---------------------
  id  name  order
  
  
  product_cat_pictures 
  ---------------------
  id  cat_id  picture_id
  
  
  picture_repository 
  ---------------------
  id  filename
  </code></pre>