Results 1 to 2 of 2
  1. #1
    akino25 is offline Novice
    Windows XP Access 2003
    Join Date
    Mar 2013
    Posts
    10

    How to extract unique record to a new table and the duplicate in another new table ?

    Hi,

    I have this database that do contains duplicate record (not duplicate field).

    What I'm trying to do here is to extract record that is unique to a new table
    And those record that were duplicate into a new table.



    the *Distinct that we used in sql will not work because it is not what I wanted. using distinc will give me unique record of the whole database.

    say i have this database that contain an ID:

    2525
    2658
    2658
    2658
    2525
    3678

    so what i want is to extract unique record to a unique table and those that contain duplicate in another table.

    so the 3678 will be put in a new table and the 2525 and 2658 in a new table
    That way it will help me see which file will have duplicate

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,943
    Why do you need to put data in other tables? An aggregate query should be able to present the duplicates/nonduplicates.

    SELECT ID, Count(ID) As CountID FROM tablename GROUP BY ID;

    SELECT ID, Count(ID) As CountID FROM tablename GROUP BY ID HAVING Count(ID) = 1;

    SELECT ID, Count(ID) As CountID 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.

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

Similar Threads

  1. Duplicate record within table
    By chris.williams in forum SQL Server
    Replies: 4
    Last Post: 02-13-2013, 09:26 AM
  2. Replies: 5
    Last Post: 05-02-2012, 07:56 AM
  3. Unique table per record?
    By Poepol in forum Access
    Replies: 8
    Last Post: 06-11-2011, 10:31 AM
  4. Replies: 1
    Last Post: 05-13-2010, 10:50 AM
  5. Replies: 0
    Last Post: 01-06-2009, 02:17 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