Skip to content

Instantly share code, notes, and snippets.

@c0ldlimit
Created July 14, 2014 15:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save c0ldlimit/892a6d65eef08a92fb4e to your computer and use it in GitHub Desktop.
Save c0ldlimit/892a6d65eef08a92fb4e to your computer and use it in GitHub Desktop.
#sql select by max(date) - select the max entry date row
--http://stackoverflow.com/questions/7836036/how-to-select-by-maxdate
SELECT report_id, computer_id, date_entered
FROM reports AS a
WHERE date_entered = (
SELECT MAX(date_entered)
FROM reports AS b
WHERE a.report_id = b.report_id
AND a.computer_id = b.computer_id
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment