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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

check for duplicate records in Command Window

Status
Not open for further replies.

kenndot

Programmer
May 15, 2001
316
US
What's the quickest way to compare 2 tables and check for duplicate field values? I just need it in the command window not in the program.

Thanks.
 
Okay, I'm sorry, I didn't mean that.

I have ONE table that I want to "read" and make sure there are no dups in a particular field within that table. I need to check the table quickly in the command window is all.
 
Hello, try that!

Select * from YourTable group by YourFieldToCheck having Count(*) > 1 Please let me know if this helped you :)

Tekno
Wireless Toyz
Ypsilanti, Michigan
 
select col1,col2,count(*);
from table;
group by col1,col2 having count(*) > 1

col1 and col2 represet the fields that you want to see if there are duplicates, this well could be one field.

the return result will should the duplicates. Attitude is Everything
 
Here is what I use:

SELECT * FROM table1 WHERE col1 IN (SELECT col1 FROM table2)

any dups will show in cursor.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top