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 6895855
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T06:57:43+00:00 2026-05-27T06:57:43+00:00

I need help with a relatively simple query. For a table: A | B

  • 0

I need help with a relatively simple query. For a table:

A | B | C 
----------
2   1   6
2   2   5
3   3   4
4   4   3
5   5   2
6   6   1

I need to have an output like so:

A | B | C 
----------
2   1   6
3   3   4
4   4   3
5   5   2
6   6   1

So that each value in A is distinct, but I also get the corresponding values in B and C. I know “select distinct(A) from table” but that only returns the values 2,3,4,5,6 and I need the values in columns B and C, too. Please help. I have a deadline fast approaching. This question is stupid and trivial, but one must walk before they can run. Thanks so much.

  • 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-27T06:57:43+00:00Added an answer on May 27, 2026 at 6:57 am

    Try this:

    SELECT T1.A, T1.B, MIN(T1.C) AS C
    FROM yourtable T1
    JOIN (
        SELECT A, MIN(B) AS B
        FROM yourtable
        GROUP BY A
    ) T2
    ON T1.A = T2.A AND T1.B = T2.B
    GROUP BY T1.A, T1.B
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a table that I would like to be able to present ranked
Need some help, I have a regular expression that appears to work just fine
I realise that to most this is perhaps a very simple query, but I'm
I would like to create very simple program that could help my relative to
I really need your help for this. I am relatively new to programming and
I need help understanding some C++ operator overload statements. The class is declared like
i need help with disk_total_space function.. i have this on my code <?php $sql=select
We have a website that contains a database of places. For each place our
I need to build a simple desktop app, my experience is with vb6 but
This should be relatively simple, here is my situation; I have copied the trunk

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.