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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T10:58:49+00:00 2026-06-08T10:58:49+00:00

I have 4 tables, and the 4 are foreign keys in one junction table.

  • 0

I have 4 tables, and the 4 are foreign keys in one junction table.

The problem is that I need to retrieve the jnction values that are missing.

For example:

Table A       Table B      Table C     Table D             
--------     ---------    ---------   ----------
  1              4            7          A
  2              5            8          B



 JUNCTION TABLE
-----------------
  1   4   7   A
  1   4   7   B
  1   4   8   A
  1   4   8   B
  1   5   7   A
  1   5   7   B
  1   5   8   A
  1   5   8   B      
  2   4   7   A
  2   4   7   B
  2   4   8   A
  2   4   8   B
  2   5   7   A
  2   5   7   B
  2   5   8   A
  2   5   8   B      

So if the column 1 5 8 B is missing, when I run the query it shows 1 5 8 B..

Any Ideas?

  • 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-08T10:58:51+00:00Added an answer on June 8, 2026 at 10:58 am

    I would use a cross join on your source tables, then join the result of that to your junction table.

    EDIT: Kudos to andy holaday for pointing out that MySQL does not have FULL OUTER JOIN.

    select x.*
    from (select *
          from a,b,c,d) as x
    left outer join j
        on (x.a = j.a and
            x.b = j.b and
            x.c = j.c and
            x.d = j.d)
    where j.a is NULL and
          j.b is NULL and
          j.c is NULL and
          j.d is NULL
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a table that has two foreign keys to two different tables with
I have a table, tblNoComp, that has two columns, both foreign keys pointing to
I'm trying to find all the tables that have foreign keys pointing to a
I have a table which is referenced by foreign keys on many other tables.
can it make sense for one table to have multiple foreign keys? Suppose I
If I have two tables; Drivers keyed by DriverId and Trips with foreign keys
I have these tables places(place_id, place_name) places_criteria(place_id, criterion_id) criteria(criterion_id, criterion_name) places_criteria have foreign keys
I have two SQL Server tables with Primary Keys (PK) and a Foreign Key
I have a relational table with two foreign-keys pointing to same table. The first
I have two tables with primary foreign key relationship. The table in foreign key

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.