Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Duplicate Records
Message
De
17/01/2002 03:49:02
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00605795
Message ID:
00605967
Vues:
16
>>I still have not really found a routine to find duplicates that works for me.
>>
>>I used to use the code that I found in Fox Pro magazine but strated using this one someone here gave to me.
>>
>>SELECT settdate, amount, orgtracnum, ;
>>	COUNT(*) AS dupes,  bankname ;
>>	FROM january ;
>>	WHERE NOT EMPTY(orgtracnum)  ;
>>	GROUP BY january.orgtracnum ;
>>	HAVING dupes > 1   ;
>>	INTO table duplicates
>>	
>>	SELECT * ;
>>	FROM january ;
>>	WHERE orgtracnum IN ;
>>	(SELECT orgtracnum FROM duplicates) ;
>>	GROUP BY orgtracnum, amount ;
>>	INTO table alldupes
The SELECT statement that will extract duplicate keys and their count is:
SELECT ;
    orgtracnum, ;
        COUNT(*) AS _count_ ;
    FROM january ;
    GROUP BY orgtracnum ;
    HAVING COUNT(*) > 1 ;
    INTO CURSOR groupkeys
Once the individual keys are extracted, each records that hold a given key can be examined with this query:
lcKey = groupkeys.orgtracnum

SELECT ;
    * ;
    FROM january ;
    WHERE orgtracnum = lcKey ;
    INTO CURSOR results
You can download a utility that I've written that does all of the query work for this job, for any given .dbf, wrapped up in a intuitive user interface. My web site, at which it may be currently found is http://www.ravenslakeconsulting.com. Let me know what you think - I'm planning on uploading to the UT in a week or two.
David M. Stowell
Ravenslake Consulting
Chicago, Illinois

e-mail: davidstowell@ravenslakeconsulting.com
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform