Results 1 to 5 of 5
  1. #1
    crowegreg is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Posts
    398

    Query containing records from a table, less the dupliates

    How do I create a query containing records from a table, excluding any duplicate records within that table?

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,632
    Which record do you want - the most recent?

    Or do you want just one field and not show duplicate values?
    SELECT DISTINCT [fieldname] FROM tablename;

    Or do you want to summarize data?
    SELECT Account, Sum(Amount) As SumAmt FROM tablename GROUP BY Account;
    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
    crowegreg is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Posts
    398
    Thanks for replying.

    I'd like for any of the duplicates to not appear in the query.

    Example Table data:

    ID Number:
    53
    56
    53
    56
    59
    30

    Query results:
    ID Number:
    59
    30

  4. #4
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,632
    You want only where the count = 1.

    Try

    SELECT ID FROM tablename GROUP BY ID HAVING Count(ID)=1;
    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.

  5. #5
    crowegreg is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Posts
    398
    Thank you. Exactly what I need!!

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

Similar Threads

  1. Replies: 9
    Last Post: 06-06-2012, 10:35 AM
  2. Replies: 2
    Last Post: 12-20-2011, 07:33 AM
  3. Replies: 2
    Last Post: 05-03-2011, 01:02 AM
  4. Replies: 0
    Last Post: 02-24-2010, 12:56 AM
  5. Query two different records in the same table
    By Eildydar in forum Access
    Replies: 5
    Last Post: 04-15-2009, 01:39 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