SQL to find all rows with the highest number value

Hello, I am having some trouble coming up with a SQL statement that will give me the results that I need and was hoping yall could help

given a table like:

ID  Day/Time                instance
1   Monday 10:00       1
2   Tuesday 10:00       1
3   Tuesday  12:00      2
4   Tuesday  18:00      3
5   Wednesday 9:00   1          

How can I query all values on the same day with only the highest instance number? so that i return something like:

ID  Day/Time                instance
1   Monday 10:00       1
4   Tuesday  18:00      3
5   Wednesday 9:00   1    

Thank you very much for taking a look and any help you can provide.
Justin HullAsked:
Who is Participating?
Justin HullConnect With a Mentor Author Commented:
I figured this out just after i posted, I dont know why i didnt think about using group by to get this done.

SELECT id, MAX(instance)
FROM YourTable

and join that back to the original table to get the selected records..

Thank you for anyone that took a peek at this.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.