Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Getting Duplicate Records

Author  Topic 

CMangano
Starting Member

16 Posts

Posted - 2001-06-26 : 17:01:36
Ok, I now how to return no duplicates using DISTINCT:

SELECT DISTINCT(column) FROM table

But, what if I want to go the other way? What if I want to return only the columns that have duplicates? Is there a way?

For example. Assume I have a table of product specs. Each product has, say, 20 specs. These specs are stored individually (meaning one spec per row), with an id that corresponds to a product.

Now, if I want to compare 2 products, I need to find only the specs that are the same for both products. So, if I was comparing 2 books, I could look for number of pages, type of book, author, etc.

How do I return the specs that are the same?


   

- Advertisement -