Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Removing double records, math problem
Message
De
16/06/2007 04:50:01
 
 
À
15/06/2007 08:54:06
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Versions des environnements
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Divers
Thread ID:
01233421
Message ID:
01233713
Vues:
7
>There are T tables, each containing N1,N2,N3...Nt unique records. Each table contains, compared to the other T-1 tables, a certain number of double records: D1,D2,... Dt. These doubles form together G groups. So SUM(D1:Dt)-G records should be deleted evenly across the tables.

It's late and I don't have as much time as I should to understand your math, but...

Are these rental lists and you are attempting to achieve fairness in your multi eliminations?

If so this should fulfill that obligation: (If not it might still work for what you need.)

Each file needs a source code field in it that is unique to that file.

Create a file that has your file source codes and a numeric to hold the duplication count, well call the numeric cnt and it is 0 for each record at the start. We'll call this file the dupcnt file. If you have 5 files this would have 5 records in it.

Also create a main merge file for your output.

Sequentially process the records from each of the source files into the merge destination file. One file after the other. Checking for duplication as you add the records.

If the dup has the same source code as the master file record you just skip adding it.

If it has a different source, find the master records source code in the dupcnt file.

Increment the count in the dup cnt file.

If if the cnt % 2 = 1 replace the record in the master file with this new record, otherwise just skip adding it. i.e. every other dup against that specific source gets replaced with the record from the new file.

That's off the top of my head, but I think that should work.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform