title: MYSQL - Use Group By with Order By with Joins
body: <p>Currently, I am having a query as below to get the counts based on the groups as below, But I having an issue with doing order by with group by when we are using the left join.</p>
  
  <p>I have tried below but it's not doing the Order By based on the Status</p>
  
  <p><strong>SQL Fiddle</strong> : <a href="http://sqlfiddle.com/#!9/3a4594/1/0" rel="nofollow noreferrer">http://sqlfiddle.com/#!9/3a4594/1/0</a></p>
  
  <p><code>SELECT 
      *
  FROM
      (SELECT 
          t.Status, COUNT(*) AS 'Count'
      FROM
          Processess P
      LEFT JOIN Tasks T ON P.TaskId = T.TaskId
      GROUP BY t.Status) x
  ORDER BY x.Status ASC;
  </code></p>
  
  <p>It gives me the result as </p>
  
  <pre><code>Status  | Count
  ----------
  OPEN | 10
  ----------
  DONE | 20
  ----------
  </code></pre>
  
  <p>But I wanted as </p>
  
  <pre><code>Status  | Count
  ----------
  DONE| 20
  ----------
  OPEN| 10
  ----------
  </code></pre>