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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T20:21:42+00:00 2026-06-15T20:21:42+00:00

I have records as follows: key | name ————– 1111 | aa 1111 |

  • 0

I have records as follows:

key  | name
--------------
1111 | aa   
1111 | bb    
2222 | cc

I need to select the key and name when the key value is distinct. When I tried:

select distinct key, name from table;

I got all the rows since the query takes distinct for the combination of the columns: key and name. But, what I need is only distinct key and I don’t care about the name. I have a lot of records, so I need a practical method.

  • 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-06-15T20:21:44+00:00Added an answer on June 15, 2026 at 8:21 pm

    Query:

    SELECT `key`, MAX(`name`) as name
    FROM `table`
    GROUP BY `key`
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a query as follows; SELECT COUNT(Id) FROM Table The table contains 33
I have a mapping that looks like this: <class name=Record> <map name=Values> <key column=RecordFK/>
I have a table of fee records (f_fee_item) as follows: Fee_Item_ID int Fee_Basis_ID int
I have a Table called MIVTable which has the following records, MIVID Quantity Value
I have a record that came from the follow linq query: using (var context
I have records in table1, if the records exist, it must copy into table2.
I have records in the database with the sort order number. Now I want
I have records with no time attached so, with the rss feed I'm just
I have 3 records in my Products Table, with ProducID 1,2,3 respectively. When I
I have some records inside an ObservableCollection. void proxy_AddPayNowOrderCompleted(object sender, AddPayNowOrderCompletedEventArgs e) { listBox1.ItemsSource

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.