Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Optimization of a select
Message
General information
Forum:
Visual FoxPro
Category:
FoxPro 2.x
Miscellaneous
Thread ID:
00248842
Message ID:
00249956
Views:
15
Taking it from another angle and assuming that the real problem is easy identification of the duplicates rather than a query about sql syntax...

This may seem like a kludge but I've done something similar and its worked pretty well for a few years!

You already have an index on
CHORPOSNUM+DTOS(DHORDJH)+STR(NHORNJH,3)

create another one but this time make it Unique.

To find dupes, you can either

set the unique index on, copy all records to a temp file in the same directory, rename the original for debugging and rename the temp file to take the place of the original file. This will eliminate duplicates in one go without the need for Rushmore. You can then examine the renamed original at your leisure to study the duplicates.

or, as part of your validation, with the unique index on, set a new (indexed) variable called, ferinstance, 'uniquerecord', to .t. as soon as the new record has been successfully added. If its a duplicate, it will be hidden by the unique index and the 'unique' variable wont be set true. At any time subsequently you can set the index to the new variable index and find all records where 'uniquerecord' is false. These are your dupes...

hope thats useful

Harry
Previous
Reply
Map
View

Click here to load this message in the networking platform