Results 1 to 6 of 6
  1. #1
    Tomfernandez1 is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Feb 2011
    Posts
    74

    Duplicate Query Reporting Unique Values...

    Greetings,

    I have a query deriving from a Union Query that has the following fields:

    Passenger Serial #
    First Name
    Last Name


    Van #
    Month

    The query essentially pulls data from multiple tables that represent 12 months in a year, and will show duplicate data by Passenger Serial #, First Name....and so on.
    I ultimately want a Find Duplicates query to show the number of people using the same Passenger Serial # over a year. The problem is Months will produce duplicates of the same information by different months.
    How do I develop a query that would show duplicates for Passenger Serial # and 'different' First Name and Last Name, and show Month?

    Example of what I want the query to show:
    1234567 Bill Smith 554 Jan
    1234567 Joe Brown 443 Mar

    In the example, Bill Smith also has duplicates in different months (Feb, Mar), but information on Joe Brown gets reported since Joe is using the same Passenger Serial #.

    Any advice would be appreciated!

    Tommy

  2. #2
    pbaldy's Avatar
    pbaldy is online now Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,530
    For starters, it's almost certainly a mistake to have the data in monthly tables like that. In any case, try changing UNION to UNION ALL. UNION by default will eliminate duplicates, UNION ALL will not.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    Tomfernandez1 is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Feb 2011
    Posts
    74
    I read up on Table normalization and realized I had a lot of work ahead of me. Meanwhile, I will act on your advice and change the query to "UNION".
    The problem might continue, so I wondered about 'IF' statements like the following perhaps:

    If Passenger Serial # matches across months, and, If First Name and Last Name do not match, then show results.

    I know the above syntax is incorrect, but any help on this would be great!

    Thanks,

  4. #4
    pbaldy's Avatar
    pbaldy is online now Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,530
    Based on your description, I think you want UNION ALL, not UNION. Including "ALL" should make it include duplicates. From help:

    By default, no duplicate records are returned when you use a UNION operation; however, you can include the ALL predicate to ensure that all records are returned. This also makes the query run faster.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    Tomfernandez1 is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Feb 2011
    Posts
    74
    Thanks, Paul!

  6. #6
    pbaldy's Avatar
    pbaldy is online now Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,530
    No problemo!
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. Adding duplicate values in a query
    By mooseisloose in forum Queries
    Replies: 3
    Last Post: 04-14-2011, 12:12 PM
  2. Creating a unique ID for a new set of values
    By slaterino in forum Programming
    Replies: 1
    Last Post: 08-24-2010, 09:35 AM
  3. Replies: 1
    Last Post: 08-18-2010, 02:36 AM
  4. Unique Values and Boolean Fields
    By Triad in forum Forms
    Replies: 1
    Last Post: 07-15-2010, 06:28 PM
  5. Count of Unique Values
    By vsmk in forum Queries
    Replies: 2
    Last Post: 03-14-2010, 12:07 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