title: Incompatibility with Mysql 5.7(Expression #1 of ORDER BY clause is not in SELECT list)
body: <p>When I execute the following query I receive an Exception:</p>
  <blockquote>
  <p>Error Code: 3065  Expression #1 of ORDER BY clause is not in SELECT
  list, references      column 'webstore.level_depth' which is not in
  SELECT list; this is incompatible with DISTINCT</p>
  </blockquote>
  <p>My Query:</p>
  <pre><code>SELECT DISTINCT c.id_parent, c.id_category, cl.name, cl.description, cl.link_rewrite
  FROM `pj_category_shop` cs, `pj_category` c
  INNER JOIN `pj_category_lang` cl ON (c.`id_category` = cl.`id_category` AND cl.`id_lang` = 1 AND cl.id_shop = 2 )
  WHERE (c.`active` = 1 OR c.`id_category` = 2)
    AND cs.`id_category` = c.`id_category`
    AND cs.`id_shop` = 2
    AND c.`id_category` != 1
    AND `level_depth` &lt;= 2
    AND c.id_category IN (
      SELECT id_category
      FROM `pj_category_group`
      WHERE `id_group` IN (3)
    )
  ORDER BY `level_depth` ASC, cl.`name` ASC;
  </code></pre>
  <p>Why is this happening?</p>