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.
JustinAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

JustinAuthor 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
GROUP BY id

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

Thank you for anyone that took a peek at this.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
SQL

From novice to tech pro — start learning today.