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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T05:09:02+00:00 2026-06-14T05:09:02+00:00

Below is the sample data: c1 c2 c3 c4 c5 1 a1 a 1

  • 0

Below is the sample data:

c1   c2   c3   c4   c5
1    a1   a     1     1
2    a2   a     2     1
3    a3   a     3     1
4    a4   a     4     1
5    b1   b     1     1
6    b2   b     2     1
7    b3   b     3     1
8    b4   b     4     1
9    a1   c     3     1 

I want to get the the below details:

c1  c2  c3  c4  c5
1    a1  a   1    1
5    b1  b   1    1
9    a1  c   3    1

C1 is primary key, the criteria is for any given unique(c2) where c4 is the lowest, I want to return the contents(all the 5 columns) of the row.

  • 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-14T05:09:04+00:00Added an answer on June 14, 2026 at 5:09 am

    Try this:

    SELECT t1.*
    FROM Table1 t1
    INNER JOIN
    (
      SELECT c3, MIN(c4) c4 
      FROM Table1
      GROUP BY c3
    ) t2 ON t1.c3 = t2.c3 ANd t1.c4 = t2.c4
    

    SQL Fiddle Demo

    Update:1 In SQL the returned results is a set set(unless you specify an ORDER BY clause, it is a cursor in this case), wherein the order is not guaranteed. This is a standard. You should use an ORDER BY clause if you want to guarantee a specific order. In your case , the results is not guaranteed to be ordered like 1 5 9. Add ORDER BY c1 instead.

    The ORDER BY clause might be crucial in some cases, for example, if want to get the top three rows, or the maximum one, in this case you have to specify an ORDER BY clause.

    So if you wants to persist a specific order the you have specify an ORDER BY.


    1 As noted by @Fahim Parker, see the comments below.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have below sample data. AID Date Title ----- ---------- ------ 1 2011-12-12 test1
I have posted my class below and with sample data. I need to pass
I am trying to binary serialize the data of vector. In this sample below
Below is a sample implementation that uses metro API and data binding (using MVVM)
I have a python script which outputs lots of data, sample is as below.
I want to make ajax call to get data for results nodes. In my
Below, I've attached a sample of my data as well as a sample of
Im having a table with notes. Below is a small sample of data of
string XML1 = <Root><InsertHere></InsertHere></Root>; string XML2 = <Root><child1><childnodes>data</childnodes><childnodes>data1</childnodes></child1><child2><childnodes>data</childnodes><childnodes>data1</childnodes></child2></Root>; Among below mentioned two code samples..
I've put together a small code-sample below (Currently in C# 3.5 but would also

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.