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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T18:20:07+00:00 2026-06-04T18:20:07+00:00

Hi everyone I have a problem with a SQL query and I can not

  • 0

Hi everyone I have a problem with a SQL query and I can not find a solution.

In my database I have two tables, Mytable1 and Mytable2. Mytable1 contains columns idCalendar, idPlayer, datePlaying and Mytable2 contains columns idPlayer and namePlayer.

I want to extract foreach date in Mytable1 the names of players who did not play.

For example
Mytable1 (contains player and playing date):


idCalendar|idPlayer|datePlaying

1         |     1  | 05/01/2012
2         |     2  | 06/01/2012
3         |     3  | 08/01/2012
4         |     2  | 05/01/2012

Mytable2 (contains all player names) :


idPlayer|namePlayer

1  | P1
2  | P2
3  | P3
4  | P4

I’d like to create a view that displays the following result :

ViewResult (players who haven’t played by date):


datePlaying | playerName

05/01/2012  | P2
05/01/2012  | P3
06/01/2012  | P1
06/01/2012  | P3
08/01/2012  | P1
08/01/2012  | P2

As you can see I need result with this information:
– in 05/01/2012 P2 and P3 haven’t played.
– in 06/01/2012 P1 and P3 haven’t played.
– in 08/01/2012 P1 and P2 haven’t played.

I hope I have been clear enough. Thank you in advance.

  • 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-04T18:20:07+00:00Added an answer on June 4, 2026 at 6:20 pm

    Probably something as simple as this would work.

    select
        d.datePlaying, p.namePlayer
    from
        table2 p
    cross join 
        (select distinct datePlaying from table1) d
    left join
        table1 t on t.idPlayer = p.idPlayer and t.datePlaying = d.datePlaying
    where
        t.idPlayer is null
    

    As a side note what happens if you have a date where non of the players played? You wouldnt have an entry in table2. Do you care or should there be a 3rd table to represent dates that any of the players should have played. This dates table would be used to replace my alias ‘d’ cross-joined table.

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

Sidebar

Related Questions

Hi everyone I'm having a problem. I have two SQL queries that are both
I have problem with my MySQL query: include '../inc/mysql_config.php'; $sql=INSERT INTO ordrar (id, order,
HI everyone I hope you can help me, I have a problem with a
Good day everyone! I have a problem regarding my date. It needs to be
Hi everyone my problem today is I have a couple of buttons that slide
Good day everyone. I have been having the same problem all day at work
hey everyone, here is the site SEE BELOW I have a slight jquery problem
Hello everyone i have a problem in my application. The check in my check
I have run into a problem wherein we keep having complex SQL queries go
Hello everyone I have a difficult problem with using BULK INSERT command when I

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.