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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T14:36:43+00:00 2026-06-06T14:36:43+00:00

I have tables like these two test_table date student test 2012-05-31 Alice Math 2012-05-31

  • 0

I have tables like these two

test_table
date        student     test
2012-05-31  Alice       Math
2012-05-31  Alice       Math
2012-05-31  Bob         Math
2012-05-31  Bob         Spelling
2012-06-01  Alice       Math
2012-06-01  Alice       Spelling

score_table
date        student     test        best_daily_score
2012-05-31  Alice       Math        90
2012-05-31  Bob         Math        50
2012-05-31  Bob         Spelling    50
2012-06-01  Alice       Math        95

I’d like to detect that Alice’s best_daily_score for the Spelling test on 2012-06-01 hasn’t been recorded yet. I’m looking for the query that returns

2012-06-01  Alice       Spelling

which is the only row of

SELECT DISTINCT date, student, test FROM test_table

that is not in

SELECT DISTINCT date, student, test FROM score_table

This doesn’t work:

SELECT DISTINCT date, student, test FROM test_table WHERE date, student, test NOT IN (SELECT DISTINCT date, student, test FROM score_table)

I assume because the left side of NOT IN should not be a list of three things.

  • 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-06T14:36:44+00:00Added an answer on June 6, 2026 at 2:36 pm

    Give this a try:

    SELECT  a.date,
            a.student,
            a.test
      FROM  test_table a 
              LEFT JOIN score_table b
                ON (a.date = b.date) AND
                   (a.student = b.student) AND
                   (a.test = b.test)
    WHERE   b.best_daily_score IS NULL
    

    The query tries to match all the records from test_table to score_table whether it exists or not because of the LEFT JOIN. It matches for date, student, and test. If the record was not found on score_table, so basically best_daily_score would be NULL. That’s why I added a condition to show only NULL on best_daily_score.

    Click Here for some DEMO (SQLFiddle)

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

Sidebar

Related Questions

I have two tables like the ones below. I need to find what exchangeRate
I have two tables like of this structure: content (content_id, content_type, user_id, time, comment_count)
Imagine I have two tables in a DB like so: products: product_id name ----------------
I have these two table with some data sample in them. I would like
I have two tables like Parent-Child. In Parent table, there are 7211 records. In
I have two MySQL tables and I would like to know if there is
I have two Tables: Table 1: Questions : QuestionId NUMERIC Title TEXT Test Data
I have two arrays of values like X,Y,Z and 1,2 There is a table
I have a table with a lot of text inputs like these: alt text
I have tables like this: tblUsers int UserID string UserName tblUsersInRoles int UserID 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.