Created
July 17, 2014 06:23
-
-
Save iyank4/d4206d9c930e85c8d55e to your computer and use it in GitHub Desktop.
Simple SQL Select with Group and Order By Specific Column
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT * FROM | |
( | |
SELECT * the_table | |
ORDER BY created_at_field DESC | |
) t | |
GROUP BY t.id_field | |
-- On MySQL with InnoDB engine this query was returning the expected result, but i have no idea with another database and engine. | |
-- Hopefully this trick would work, tell me if it's not. And maybe you can use more complex query as explined on stackoverflow or others. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment