Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6555683
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T12:51:00+00:00 2026-05-25T12:51:00+00:00

Hopefully this is pretty simple, but I’m having some trouble. I have a table

  • 0

Hopefully this is pretty simple, but I’m having some trouble. I have a table that has multiple fields but basically the two that matter are ID and year. A single ID can exist in many years. How do I set up a select statement (Which I’m ultimately using in a join in another statement) so that I can retrieve all of the distinct IDS with no duplicates for the top year that they exist for?

If there is a set of records like this:

ID - Year
55 - 2000
55 - 2001
56 - 2000
56 - 2002

So basically I want something like this returned:

55 - 2001
56 - 2002

Help?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T12:51:00+00:00Added an answer on May 25, 2026 at 12:51 pm
    SELECT ID, MAX(Year) FROM MyTable GROUP BY ID
    

    References:

    • SELECT (Transact-SQL)
      • GROUP BY (Transact-SQL)
    • Aggregate Functions (Transact-SQL)
      • MAX (Transact-SQL)
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

New to MVC, so hopefully this will be pretty simple. I have an HTML
hopefully a pretty simple question this time. I have a Select method in a
Hopefully this is a pretty simple question for someone to answer. I have a
Ok, this should be simple, but I'm having a fair amount of trouble with
This is probably (hopefully) a pretty simple question, but I can't seem to get
This isn't a very simple question, but hopefully someone has run across it. I
I'm pretty new to Python, so hopefully the problem I'm having has a simple
I have a hopefully pretty simple question here. I'm converting some Access SQL script
Hopefully this is simple: I have a relatively long list where each list item
hopefully this doesn't sound ridiculous, but are some parts of the web.config not required

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.