Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Removing double records, math problem
Message
From
15/06/2007 15:00:14
 
 
To
15/06/2007 14:52:18
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01233421
Message ID:
01233615
Views:
11
>>You take it too literally. 'Duplicates' in one table means that you check records against the cursor that holds all duplicate records. If it's there then it could be deleted.
>>The deletion itself can proceed in a very straightforward way: as soon as you determined that 120 records should be deleted in Table1 then you just go, scan and delete first 120 records that qualify. Next you go to Table2 and do the same, etc.
>
>And to make that more evenly distributed across the table, if in table1 there are 300 deletable records, you make a list of their keys (or record numbers), and pick from that list at random until you've deleted 120. You also need to remove the selected ones from the lists for other tables as well, or from the global list of duplicates (as soon as there's more than one candidate for each set of duplicates).
>
>I like this better than my first solution.

Certainly, deletion can be produced not through simple scan, but through more randomized process, and even seqence of tables for scan/delete can be randomized. It should improve stochastics.
Global duplicate list should contain key fields and dup.counter, so every deletion will reduce the counter and when it reaches 1, no more deletion will be allowed for the key.
Edward Pikman
Independent Consultant
Previous
Reply
Map
View

Click here to load this message in the networking platform