Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Test for Duplicate record
Message
From
01/05/2010 14:35:17
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
 
 
To
01/05/2010 14:25:12
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Miscellaneous
Thread ID:
01462657
Message ID:
01462660
Views:
61
>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)
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform