Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Duplicates in a table
Message
De
10/09/2003 11:07:31
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivie
 
 
À
10/09/2003 10:59:22
Steven Dyke
Safran Seats USA
Texas, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00827861
Message ID:
00827867
Vues:
14
>I have a table that collects multi-user inputs for processing. Sometimes the processing isn't as fast as the user thinks it should be and submitts the request again. This causes the process problems. Before the process starts how can I go through the table and clean out any first duplicate entries?

The following statement can check for duplicates. Let's assume the table has a PK field called MyPK.
select MyPK, count(*) as HowOften;
  from MyTable;
  group by MyPK;
  having HowOften > 1;
  into cursor Temp
From there, you would have to decide which of the duplicates to delete. There are several ways to solve this. For instance, you could write a program that goes to the table for each MyPK, does a SEEK, SKIPs to the next record, and then deletes while the MyPK field doesn't change.
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform