Results 1 to 5 of 5
  1. #1
    hithere is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Sep 2011
    Posts
    63

    Join Query

    I have two tables and am trying to connect them with a query.



    The first table, Individual Demographics, contains basic information about the person

    The second table, Order, info contains order information i.e. date, item, etc. These two tables are joined via the unique individual identifier.

    In the query what I would like to do is display only those individuals that have an order and their unique individual identifier. The catch is that I would only like for their name to appear once regardless of how many orders they have. I have tried several different joins and I get back a list of those patients with an order but a name is repeated several times if they have more than one order. Is there any way to get around this?

  2. #2
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,726
    Yes, the answer lies in properly structuring the tables using a process called Normalization. The issue you described is related to the table structures and the duplicate storage of data.

    The first few links here can be helpful to you
    http://www.rogersaccesslibrary.com/forum/topic238.html

  3. #3
    Newbie11 is offline Advanced Beginner
    Windows 2K Access 2003
    Join Date
    Dec 2011
    Posts
    41
    I think I already have my tables set up that way. The first table only has demographic information and the second table only has order information. These two tables are linked by only one field, the unique identifier and it's a one to many relationshp. One person can have more than one order.

    My problem is coming up with a query that joins the tables listing individuals with an order only once versus multiple times.

  4. #4
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,726
    Quote Originally Posted by Newbie11 View Post
    I think I already have my tables set up that way. The first table only has demographic information and the second table only has order information. These two tables are linked by only one field, the unique identifier and it's a one to many relationshp. One person can have more than one order.

    My problem is coming up with a query that joins the tables listing individuals with an order only once versus multiple times.
    Please post your tables and relationship structure, and your query sql. and I'm sure someone will offer suggestions/advice/options.

  5. #5
    Aragan is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Jan 2012
    Posts
    22
    SELECT DISTINCT Name, Id
    FROM [Individual Demographics],Orders
    WHERE
    Id = Orders.IndividualId

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Join Query?
    By KWarzala in forum Forms
    Replies: 5
    Last Post: 07-29-2014, 02:44 PM
  2. Join 4 Tables in 1 Query
    By sandlucky in forum Queries
    Replies: 5
    Last Post: 06-12-2011, 06:28 PM
  3. SQL query with SUM, INNER JOIN and GROUP BY
    By BayerMeister in forum Queries
    Replies: 2
    Last Post: 08-14-2010, 12:55 AM
  4. inner join in query
    By Hrcko in forum Access
    Replies: 1
    Last Post: 02-01-2010, 05:54 PM
  5. Stuck on Join Query
    By Pimped in forum Queries
    Replies: 1
    Last Post: 10-26-2009, 10:54 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums