Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Duplicate Records
Message
From
17/01/2002 03:49:02
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00605795
Message ID:
00605967
Views:
17
>>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
Previous
Reply
Map
View

Click here to load this message in the networking platform