>>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 alldupesThe 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 groupkeysOnce 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 resultsYou 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.