CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Sep 2000
    Location
    Ottawa, Ontario
    Posts
    356

    removing duplicates from access97 database

    I have a access database containing a table called Contact, the table contains these fields Name,Address,Phone. I need to find the duplicate phone #'s and remove all but 1 of them from the database. I do not have a primary key and I cannot add one. (if I add it I have to do it programatically) Any Idea how to do this without looping thru the database (some of these databases contain over 10,000 rows ) ????

    Jean-Guy


  2. #2
    Join Date
    Jan 2000
    Location
    MO, USA
    Posts
    1,506

    Re: removing duplicates from access97 database

    Isn't there a Find Duplicates wizard in Access? I think if you goto Insert, then Query - in the New Query window - choose Find Duplicates Wizard, you can get a query that will do this for you. otherwise, you could something like this:

    SELECT
    PhoneNumber
    FROM
    Table
    GROUP BY
    PhoneNumber
    HAVING
    Count(PhoneNumber) > 1




    that would at least get you a list of all the duplicates, then you'd have write some other query that would delete them.

    good luck,

    john

    John Pirkey
    MCSD
    http://www.ShallowWaterSystems.com
    http://www.stlvbug.org
    John Pirkey
    MCSD (VB6)
    http://www.stlvbug.org

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured