Skip to content

Instantly share code, notes, and snippets.

@skarger
Created June 14, 2019 16:50
Show Gist options
  • Save skarger/91953039ed388ea8ef64e68dca5c4ba4 to your computer and use it in GitHub Desktop.
Save skarger/91953039ed388ea8ef64e68dca5c4ba4 to your computer and use it in GitHub Desktop.
SELECT DISTINCT ON (workouts.sport_id) workouts.*
FROM workouts
ORDER BY sport_id ASC, created_at DESC
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment