Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

search for recurring names

Status
Not open for further replies.

lipo

Programmer
Nov 25, 2002
52
0
0
US
I have to search for possible recurring names in a table with about 6000 records. How do I make a temp file with just the few names that recurred more than once? I indexed on lastname, but then I would have to manually check for repeat occurrence for each name and the table has too many records.
 
Select NAME,sum(1) as Ncnt group by Name having NCnt>1

Brian
 
Also, don't forget the 'FROM mytable' clause like I just did [smile]

Brian
 
Could someone write more specific code?
 
lipo

Could someone write more specific code?

I think Brian's suggestion is as specific as the amount of information you supplied. Anymore specific, we would know the actual name of the table and the actual name of the fields in the table. Which you did not provide.

Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Lipo,

Could someone write more specific code?

It's difficult to see how we can be more specific than Brian's example. However ....

Assuming your table is called BigTable, and the field holding the name is called Name, the following code will give you a browse window showing all names that occur more than once. This is Brian's code, so give him the credit for it.

Code:
Select NAME, sum(1) as Ncnt from BigTable group by Name having NCnt>1

Mike





Mike Lewis
Edinburgh, Scotland

My Visual Foxpro web site: My Crystal Reports web site:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top