Skip to content

Instantly share code, notes, and snippets.

@asjustas
Created November 20, 2012 13:32
Show Gist options
  • Save asjustas/4117951 to your computer and use it in GitHub Desktop.
Save asjustas/4117951 to your computer and use it in GitHub Desktop.
Sort before group by
SELECT * FROM
(
select * from `my_table` order by timestamp desc
) as my_table_tmp
group by catid
order by nid desc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment