Results 1 to 4 of 4
  1. #1
    GraeagleBill's Avatar
    GraeagleBill is offline Experienced Old Geezer
    Windows 10 Access 2013 32bit
    Join Date
    Feb 2011
    Posts
    1,919

    Duplicates in query need to NOT be suppressed

    I have a UNION query comprised of three parts. The first part has 2 duplications in the fields you see in RED, which in this case SHOULD NOT be suppressed. When the query runs, only one of the two records are returned. If I run the first section of the query by itself the duplicates are returned. Is there something about UNION queries that cause the suppression? If so, how do I turn it off so that the duplicate(s) are returned?


    Code:
    SELECT DonRegFam.DOE, NameFn([Familyname]) AS Name, DonRegFam.CheckNo, DonRegFam.Amount
    FROM Families INNER JOIN DonRegFam ON Families.FamilyID = DonRegFam.FamilyID
    WHERE (((DonRegFam.CheckNo)<>""))
    UNION SELECT DonRegInd.DOE, NameFn([LastName] & "," & [FirstName]) AS Name, DonRegInd.CheckNo, DonRegInd.Amount
    FROM Registry INNER JOIN DonRegInd ON Registry.RegistryID = DonRegInd.RegistryID
    WHERE (((DonRegInd.CheckNo)<>""))
    UNION SELECT DonUnReg.DOE, NameFn("") AS Name, DonUnReg.CheckNo, DonUnReg.Amount
    FROM DonUnReg
    WHERE (((DonUnReg.CheckNo)<>""))
    ORDER BY name;

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    UNION by itself suppresses duplicates, UNION ALL does not. That also makes it more efficient.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    GraeagleBill's Avatar
    GraeagleBill is offline Experienced Old Geezer
    Windows 10 Access 2013 32bit
    Join Date
    Feb 2011
    Posts
    1,919
    Got it, thanks.
    Bill

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    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. Can the option to "Check Out" be suppressed?
    By John_G in forum SharePoint
    Replies: 1
    Last Post: 01-10-2017, 07:02 PM
  2. Replies: 3
    Last Post: 01-18-2016, 01:55 PM
  3. Query Duplicates
    By sgremp1 in forum Queries
    Replies: 4
    Last Post: 08-22-2014, 06:06 PM
  4. Suppressed run time error 2501
    By RachelBedi in forum Programming
    Replies: 8
    Last Post: 10-24-2012, 12:26 PM
  5. Duplicates in Query
    By Dega in forum Queries
    Replies: 1
    Last Post: 05-02-2010, 05:09 PM

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