Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
GET RID OF DUPLICATES
Message
De
28/11/2000 12:34:26
 
 
À
28/11/2000 12:19:21
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00446244
Message ID:
00446266
Vues:
15
One way I can think of:
SET DELETED ON

SCAN
   lcCity = Upper(AllTrim(MyTable.City))
   lcState = Upper(AllTrim(MyTable.State))
   lcCountry = Upper(AllTrim(MyTable.Country))
   lcTerritory = Upper(AllTrim(MyTable.Territory))
   SELECT Count(MyTable.*) AS Cnt;
      FROM MyTable;
      WHERE (Upper(AllTrim(MyTable.City)) == lcCity) AND;
            (Upper(AllTrim(MyTable.State)) == lcState) AND;
            (Upper(AllTrim(MyTable.Country)) == lcCountry) AND;
            (Upper(AllTrim(MyTable.Territory)) == lcTerritory)
      INTO CURSOR curTemp

   IF curTemp.Cnt > 1
      SELECT MyTable
      DELETE
   ENDIF

   USE IN curTemp
ENDSCAN
HTH
>I have a table with the following fields:
>
>city
>state
>county
>territory
>
>There are several thousand records. I want to get rid of all of the duplicates; Just have one record for each unique record.
>
>Does anyone have an example of code that would go through the table and mark all but one of all duplicate records for deletion?
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform