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

  • SEARCH
  • Home
  • 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 3843676
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T15:58:19+00:00 2026-05-19T15:58:19+00:00

My today’s problem is that I have a table that has rows like that:

  • 0

My today’s problem is that I have a table that has rows like that:

ID NAME NUMBER IDN
1  dsad 500600 12
1  dsad 600700 13
2  kkkk 111222 56
2  kkkk 333232 57

in one ID example 1 i have 2 identical names 2 different numbers and different IDN.

What i want is to extract single row For each Id where the idn value is the smaller one.
So I want to have sommething like that

1  dsad  500600 12
2  kkkk  111222 56

Is it posible to write a single sql to have that result? I tried to group that by ID and NAME and have the min(IDN) but I’m stuck with the number field 🙂 any ideas?

  • 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-19T15:58:19+00:00Added an answer on May 19, 2026 at 3:58 pm

    You were almost there, just add the MIN(Number) field.

    SELECT  ID
            , NAME
            , MIN(NUMBER)
            , MIN(IDN)
    FROM    ATable
    GROUP BY
            ID
            , NAME
    

    In response to comment

    Following would get you the records with the MIN(IDN), regardless what the number for that specific record is.

    SELECT  t.*
    FROM    ATable t
            INNER JOIN (        
              SELECT  ID, IDN = MIN(IDN)
              FROM    ATable
              GROUP BY ID
            ) tmin ON tmin.ID = t.ID
                      AND tmin.IDN = t.IDN
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Today while writing some Visual C++ code I have come across something which has
today i have a simple an understable problem for me . Next code: alphavar
Today, I ran into this weird problem with a user using Mac OS X.
Today I discovered that my fresh installation of Apache HTTP Server is able to
Today I stumbled about a Problem which seems to be a bug in the
Today somebody told me that interface implementation in C# is just Can-Do relationship, not
Today my Visual studio couldn't help me by auto complete so I thought that
today, i am defining a set of variables in a hash that I use
Today, I encounter a strange problem. My c++ code can work under debug mode.
today i get this error The specified path, file name, or both are too

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.