Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
An SQL Challenge (it's a challenge for me anyway)
Message
 
À
21/10/1997 17:53:55
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00055877
Message ID:
00055931
Vues:
34
>I need to find potentially duplicate records in my membership database. The search needs to do the following:
>Look at all records with a system assigned ssn (our system assigned numbers start with "000") and compare them to all other records to check for people with the same last name living in the same city. I have created a subset table containing only the records with system assigned ssns, but I am sort of scratching my head as to what to do next. The main table is unavailable to me for esclusive use... should I copy it in order to create additional indexes to search on? Is there a single SQL statement that would take care of this? Thanks in advance for any help.

Am I wrong that you're looking for duplicates in the MAIN table for people with '000' numbers which are now also listed in your new table?
SELECT *, count(*) as NumTimes, last+city as LastCity from MainMember;
  where last+city in (Select last+city as LastCity  from SystemMembers);
  group by lname, city having NumTimes > 1
You may have to split up the Last and City fields and check them separately. Particularly if the combined field slows things down without an index. (You probably have indexes on Last and City)

HTH
Barbara
Barbara Paltiel, Paltiel Inc.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform