title: ORDER BY Not working with GROUP BY
body: <p>I have written sql code using group by and order by but in here order by not working can any one help me</p>
  
  <pre><code>SELECT " . DB_PREFIX . "leaderboard_scores.* , SUM(" . DB_PREFIX . "leaderboard_scores.score) as total_score, " . DB_PREFIX . "customer.firstname, 
          " . DB_PREFIX . "customer.lastname
  FROM " . DB_PREFIX . "leaderboard_scores 
  JOIN " . DB_PREFIX . "customer ON  " . DB_PREFIX . "leaderboard_scores.philips_store_id = " . DB_PREFIX . "customer.customer_id
  GROUP BY " . DB_PREFIX . "leaderboard_scores.phi_store_id
  ORDER BY " . DB_PREFIX . "leaderboard_scores.week DESC
  </code></pre>
  
  <p>This query work without php errors but given middle rows without giving top weeks. weeks store using times stamp</p>
  
  <p><strong>actual query</strong></p>
  
  <pre><code>SELECT rc_leaderboard_scores.* , SUM(rc_leaderboard_scores.score) 
  as total_score, rc_customer.firstname, rc_customer.lastname 
  FROM rc_leaderboard_scores 
  JOIN rc_customer 
  ON rc_leaderboard_scores.phi_store_id = rc_customer.customer_id 
  GROUP BY rc_leaderboard_scores.phi_store_id 
  ORDER BY rc_leaderboard_scores.week DESC 
  </code></pre>