Results 1 to 5 of 5

Thread: Inner Join help

  1. #1
    Join Date
    Sep 2003
    Posts
    176

    Unanswered: Inner Join help

    Hi,

    I have a parent table and 6 child tables. I need to hook them up using join.

    Parent Table -
    Col 1 Col2 Col3 etc.

    ID (PK)

    Child tables ( there exists 6 of these) -

    Col1 Col2

    ID(FK)


    I cannot figure out the inner join syntax. Please help

  2. #2
    Join Date
    Jul 2002
    Location
    Village, MD
    Posts
    621
    BOL:

    A join that displays only the rows that have a match in both joined tables. (This is the default type of join in the Query Designer.) For example, you can join the titles and publishers tables to create a result set that shows the publisher name for each title. In an inner join, titles for which you do not have publisher information are not included in the result set, nor are publishers with no titles. The resulting SQL for such a join might look like this:
    SELECT title, pub_name
    FROM titles INNER JOIN
    publishers ON titles.pub_id = publishers.pub_id

  3. #3
    Join Date
    Sep 2003
    Posts
    176

    Inner Join help

    What if I want to select all columns from titles ( I don't need any columns from Publisher)?
    I want to select all columns from titles based on the pub_id field.

    The pub_id exists in titles (parent table) and it also exists in publisher(child table) plus 5 more child tables (say pub1 to pub 5).

    Now how will the syntax be?


    Originally posted by snail
    BOL:

    A join that displays only the rows that have a match in both joined tables. (This is the default type of join in the Query Designer.) For example, you can join the titles and publishers tables to create a result set that shows the publisher name for each title. In an inner join, titles for which you do not have publisher information are not included in the result set, nor are publishers with no titles. The resulting SQL for such a join might look like this:
    SELECT title, pub_name
    FROM titles INNER JOIN
    publishers ON titles.pub_id = publishers.pub_id

  4. #4
    Join Date
    Jul 2002
    Location
    Village, MD
    Posts
    621

    Re: Inner Join help

    Originally posted by vivek_vdc
    What if I want to select all columns from titles ( I don't need any columns from Publisher)?
    I want to select all columns from titles based on the pub_id field.

    The pub_id exists in titles (parent table) and it also exists in publisher(child table) plus 5 more child tables (say pub1 to pub 5).

    Now how will the syntax be?
    SELECT titles.*
    FROM titles INNER JOIN
    publishers ON titles.pub_id = publishers.pub_id

  5. #5
    Join Date
    Oct 2003
    Posts
    706

    Re: Inner Join help

    ...plus 5 more child tables (say pub1 to pub 5)...

    Oops! A "repeating group!" Or, a "repeating table" perhaps. Anytime you see a number after a table name it probably represents something that would be better represented by having just one table...
    ChimneySweep(R): fast, automatic
    table repair at a click of the
    mouse! http://www.sundialservices.com

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •