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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T17:41:12+00:00 2026-05-19T17:41:12+00:00

i have three tables: A, B and C, B is the table necessary to

  • 0

i have three tables: A, B and C, B is the table necessary to break the many to many relationship:

table A   table B   table C
-------   -------   -------
id        id        id
....      id_A      ...
....      id_C      ...

and i have two multiselect html object two display the results, in the second one i need the intersection of both, that is a simple inner join.

the problem is the first one, i need to display there all items are available, so not the same items could be displayed in both.

in a first time, in order to fill the first multiselect i just do a table A left join with table B where the B.id is null, that was ok:

select * from tableA as A
left join tableB as B on A.id = B.id_A
where B.id_A is null

but after that i realized that there is a problem, because if there another relation AC, this relation will appear in both multiselect, so i tried:

select * from tableA as A
left join tableB as B on A.id = B.id_A
where B.id_A is null or B.id_C != $id

and doesn’t work, i need a way to display en the first multiselect only the available and not repeat options every time i change the id_C

i hope somebody can help me 🙂

  • 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-05-19T17:41:12+00:00Added an answer on May 19, 2026 at 5:41 pm

    try this,

    SELECT tableC.field1, tableC.field2
    FROM tableC
    LEFT JOIN tableB ON tableC.ID = tableB.ID_C
    AND tableB.ID_A = $ID_A
    WHERE tableB.ID_A IS NULL
    GROUP BY tableC.field1, tableC.field2

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

Sidebar

Related Questions

I have three tables in the many-to-many format. I.e, table A, B, and AB
Say I have three tables: Fruit (Table 1) ------ Apple Orange Pear Banana Produce
I have three tables like this: Person table: person_id | name | dob --------------------------------
I have three tables Category, Movies and RelCatMov Category-table categoryid, categoryName 1 thriller 2
i have this three tables. Table: Item Columns: ItemID, Title, Content, NoChange (Date) Table:
I have a table which needs to link one of three seperate tables, but
I have users table. There are three other tables: developers, managers, testers. All of
I have a database with three tables: user_table country_table city_table I want to write
Assuming I have three tables : TableA (key, value) TableB (key, value) TableC (key,
I have three tables: page, attachment, page-attachment I have data like this: page ID

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.