Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Test for Duplicate record
Message
De
01/05/2010 14:35:17
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivie
 
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Divers
Thread ID:
01462657
Message ID:
01462660
Vues:
60
>Is there a quick way to test a database for a duplicate record?
>
>Sample [mydata.dbf] check for duplicate in field [name]
>i have a rather cumbersome way of checking and would like to know if there is a more efficient code.
>
>thanks alot
>k

Yes, this is fairly easy with SELECT - SQL. For example:
select name, count(*) as count;
  from mydata;
  group by name;
  having count > 1
GROUP BY will create a single record for each [name] in this case; count(*) counts the records in each group; HAVING will evaluate the condition after the records are grouped.
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
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform