Results 1 to 7 of 7
  1. #1
    skipnick is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Dec 2013
    Posts
    6

    Finding duplicates in two fields

    I have a table with something like 30000 entries, and I would like it to show me only the entries that have different corresponding field 2 values for their field 1 value. For instance, if my first entry had a field 1 value of 1 and a field 2 value of A, I would like my query to neglect to show me all other entries that have 1 and A and then show me any entries that have a 1, but a different letter to go with it. It's hard to explain and I'm sure there must be an easy way to solve it.



    In otherwords i would like it to show me all combinations of field 1 and field 2 that appears in the table, but only once
    Last edited by June7; 12-10-2013 at 01:03 AM.

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,920
    Try GROUP BY or DISTINCT or DISTINCT ROW.

    The first is an aggregate (Totals) query.

    SELECT field1, field2 FROM table GROUP BY field1, field2;

    The other two are properties of a query that can be set in the query builder Property Sheet.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    skipnick is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Dec 2013
    Posts
    6
    the GROUP BY query worked a treat, thanks

  4. #4
    skipnick is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Dec 2013
    Posts
    6
    How could i go about having it show my other fields at the same time? If i select all fields in the GROUP BY query, it tries to find duplicates of all fields

  5. #5
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,920
    If you have several records with 1 and A, how will the query know which record to show? Which one do you want to be shown? Is there a unique ID field (such as autonumber)?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  6. #6
    skipnick is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Dec 2013
    Posts
    6
    It doesn't matter which is shown, each field 1 has only one correct field 2 value, how ever some if my untried have false data so I only need one of each combination be they correct or incorrect. The incorrect ones however, I need the rest of my fields so I can find the location of the incorrect data and change it

  7. #7
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,920
    Not sure I understand that.

    Maybe use TOP N to return one record for each field1/field2 pair. Requires nested subquery and probably a unique ID field (autonumber will serve). Review http://allenbrowne.com/subquery-01.html#TopN
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

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

Similar Threads

  1. Replies: 4
    Last Post: 06-18-2013, 07:36 AM
  2. Replies: 2
    Last Post: 06-13-2013, 09:10 AM
  3. Allow ONLY duplicates in two fields
    By KWasley in forum Access
    Replies: 1
    Last Post: 04-17-2013, 09:04 AM
  4. Replies: 1
    Last Post: 01-30-2013, 03:27 PM
  5. Replies: 1
    Last Post: 05-02-2012, 01:33 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