Results 1 to 4 of 4

Thread: New To Sql

  1. #1
    Join Date
    Sep 2003
    Location
    Richmond, CA
    Posts
    11

    Unanswered: New To Sql

    I am new to sql and have a project that requires me to join multiple tables. Currently I am trying to join two tables that both have names and addresses of people. One table is of adults and the other is of children with supervising adults. I have been able to create a join of both of them, but, for instance, when an adult is listed as the supervising adult for a child, the adult list is almost doubled in size making the table an untrue reflection of what I am trying to achieve. Can anyone help me with this problem?

    thanks

    stu

  2. #2
    Join Date
    Sep 2003
    Location
    Dallas
    Posts
    182
    Need more information on fields and what you are trying to join to. If you want a single list on names than you may want to list All children, All Adults and, All supervising Adults not in the adult list.

  3. #3
    Join Date
    Sep 2003
    Location
    Dallas
    Posts
    182
    Need more information on fields and what you are trying to join to. If you want a single list on names than you may want to list All children, All Adults and, All supervising Adults not in the adult list.

    Or you may only want all adults and All children.

    What you want will determine your query/join

  4. #4
    Join Date
    Oct 2003
    Posts
    706

    Re: New To Sql

    Originally posted by stuman413
    I am new to sql and have a project that requires me to join multiple tables. Currently I am trying to join two tables that both have names and addresses of people. One table is of adults and the other is of children with supervising adults. I have been able to create a join of both of them, but, for instance, when an adult is listed as the supervising adult for a child, the adult list is almost doubled in size making the table an untrue reflection of what I am trying to achieve. Can anyone help me with this problem?

    If a parent has two children then a join will produce a {parent, child} row for each child; thus the parent's name will indeed be listed twice. Perhaps you should state what the result is that you want. Do you want "all parents, with their name and address?" In that case your query might involve the Child table but have no checkmarked fields (QBE grid) or would list only fields from the Parent table in the SELECT clause {listing the child table only in the JOIN clause}.

    Also don't overlook the idea of running two queries in a row. Run one to get the base results... even with duplicated parents... then query that answer-table to select the parent-name, address, and so-on. Then run your report or what-have-you from that second result table.

    "Anything that gets you what you want" will work just as well.
    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
  •