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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T07:22:13+00:00 2026-06-11T07:22:13+00:00

Here are the tables I have: Table A which has entries with item and

  • 0

Here are the tables I have:

Table A which has entries with "item" and "grade" fields
Table B which has entries with A.id
Tuple table B-C

I want all the A entries that have item= “x” and grade = “y”
And all the C entries that are associated with a B entry that is associated with an A entry that has item = “x” and grade = “y”

For example

A table:

    A.item = "x", A.Grade = "y", A.id = 1
    A.item = "x", A.Grade = "y", A.id = 2
    A.item = "x", A.Grade = "y", A.id = 3
    A.item = "r", A.Grade = "z", A.id = 4

B Table

   B.AID = 1, B.id = 10
   B.AID = 1, B.id = 11
   B.AID = 2, B.id = 13
   B.AID = 3, B.id = 14
   B.AID = 4, B.id = 15

B-C Tuple Table

   BID = 10, CID = 20
   BID = 11, CID = 20
   BID = 13, CID = 20
   BID = 15, CID = 21

The query should return all the entries in the A table and the entry 20 but not 21 in the C table because C.id = 21 is only tupled with a B that is associated with an A that does not meet the item and grade requirements.

  • 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-11T07:22:15+00:00Added an answer on June 11, 2026 at 7:22 am

    The associations, while sounding complicated in written form, are just a simple join among three tables: a joins to b joins to c.

    You identify how the columns need to be joined: “a B entry that is associated with an A entry”, and looking at the columns sounds like you want to join on b.aid = a.id. Similarly for b and c.

    SELECT ...
    FROM
        a
        JOIN b ON b.aid = a.id
        JOIN b_c ON b_c.bid = b.id
    WHERE
        ...
    

    This constructs the original dataset before it was split into the three normalised tables.

    The next step is to filter by the given conditions. You only want rows where ” item = “x” and grade = “y””, so add those to WHERE clause prefixing them with the table name, which is optional in this case):

    WHERE
        a.item = 'x'
        AND a.grade = 'y'
    

    Finally, you can pick which columns you really need, in the SELECT clause. I’m gussing SELECT b_c.cid would do. Though if you also have a c table you might want to join on that table, too, and select columns from it.

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

Sidebar

Related Questions

I have a table y Which has two columns a and b Entries are:
have a poll table which has 10 categories and I want to view the
here's my question: I have a table TRUST(id INT, trustlevel INT) which contains records
I have a question. I have here 2 tables table 1 : products product_id
Here's the scenario: I have 2 tables: CREATE TABLE dbo.API_User ( id int NOT
I have two tables: entitytype and project . Here are the create table statements:
Here's my toy setup. I have 3 tables. One table is a guest list
I have 2 tables: Table 1. options_ethnicity with the following entries: ethnicity_id ethnicity_name 1
I have a Skills table which has 14 records in it. It is structured
The table I'm using has 3 important columns on which to exclude entries in

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.