MySQL order of query
Can you please post an example of your query? Without knowing what your query structure look likes, this will be difficult to fix. However here is an example that may point you in the right direction based off of your post title, in regards to ORDER and GROUP:

SELECT pkey,
       COUNT(int),
  FROM my_table
  LEFT JOIN this_table USING (key)
 GROUP BY 1
 ORDER BY 2;