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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T03:06:02+00:00 2026-06-02T03:06:02+00:00

Data: Name | Score | Date == John | 10 | 09/01/2012 John |

  • 0

Data:

Name | Score | Date
==
John | 10 | 09/01/2012
John | 20 | 09/01/2012
John | 5 | 09/01/2012
Frank | 20 | 11/01/2012

I want to run an SQL statement that will pull only the highest score from each day only, so I don’t want three scores from one date, only the highest. So the return I’d like from SQL would be:

John  | 20 | 09/01/2012    
Frank | 20 | 11/01/2012

Is it possible to do this via SQL, currently I can do it after pulling everything by checking dates. But would be great if it’s possible to do it direct from the DB.

I have tried a few solutions but as Date and Score aren’t distinct, as I want the highest I am unsure of where to proceed. The SQL is being used with a MS Access database.

  • 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-02T03:06:03+00:00Added an answer on June 2, 2026 at 3:06 am

    Here’s a complete example. I did it in Oracle, so you might have to tweak the syntax a bit for Access.

    CREATE TABLE tbl1 (NAME VARCHAR2(100), score INT, Dt DATE);
    
    INSERT INTO tbl1 VALUES ('John',10,to_date('20120901','YYYYMMDD'));
    INSERT INTO tbl1 VALUES ('John',20,to_date('20120901','YYYYMMDD'));
    INSERT INTO tbl1 VALUES ('John',5,to_date('20120901','YYYYMMDD'));
    INSERT INTO tbl1 VALUES ('Harry',15,to_date('20120901','YYYYMMDD'));
    INSERT INTO tbl1 VALUES ('Frank',20,to_date('20121101','YYYYMMDD'));
    
    
    select a.dt
         , b.name
         , a.score
      FROM (SELECT dt
                 , MAX(score) score
              FROM tbl1
           GROUP BY dt) a
         , (SELECT NAME
                 , dt
                 , MAX(score) score
              FROM tbl1
           GROUP BY name, dt) b
      WHERE a.dt = b.dt
        AND a.score = b.score       
    

    Output:

    1   11/1/2012   Frank   20
    2   9/1/2012    John    20
    

    Note that if two people have highest score for given day, it will print them both. For example:

    INSERT INTO tbl1 VALUES ('John',10,to_date('20120901','YYYYMMDD'));
    INSERT INTO tbl1 VALUES ('John',20,to_date('20120901','YYYYMMDD'));
    INSERT INTO tbl1 VALUES ('John',5,to_date('20120901','YYYYMMDD'));
    INSERT INTO tbl1 VALUES ('Harry',20,to_date('20120901','YYYYMMDD'));
    INSERT INTO tbl1 VALUES ('Frank',20,to_date('20121101','YYYYMMDD'));
    
    
    select a.dt
         , b.name
         , a.score
      FROM (SELECT dt
                 , MAX(score) score
              FROM tbl1
           GROUP BY dt) a
         , (SELECT NAME
                 , dt
                 , MAX(score) score
              FROM tbl1
           GROUP BY name, dt) b
      WHERE a.dt = b.dt
        AND a.score = b.score       
    

    Output:

        DT          NAME    SCORE
    1   11/1/2012   Frank   20
    2   9/1/2012    John    20
    3   9/1/2012    Harry   20
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to store data, the problem is that I only know the name
I have to link a date and a name to some jpegs that I
I have data that looks like this: entities id name 1 Apple 2 Orange
my model store image described with file name (as String) and data (as byte
I am building a very simple app to store data on people like name,
I am trying to access my json data name on jsp page from android
I have a table emp with following structure and data: name dept salary -----
Is there a free source with basic yellow pages data(name,address, phone#)? I don't mind
I am looking for some query help here is the following table data Name
I have table in data base name train delay, with columns train number(int), DelayTime(int),

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.