Reputation: 43778
Does anyone know how can I display records that are not duplicated record inside results in SQL Server?
Upvotes: 1
Views: 14663
Reputation: 453287
Another interpretation of the question.
SELECT *
FROM yourtable t1
WHERE NOT EXISTS
(SELECT *
FROM yourtable t2
WHERE t1.col_to_match_for_duplicates=t2.col_to_match_for_duplicates
AND t1.primarykey <> t2.primarykey
)
Upvotes: 2
Reputation: 146499
If you really meant "records that with no duplicate record ", i.e., every row that exists once, and only once, Try this:
Select * From Table
Group By [Here list all columns in Table]
Having Count(*) = 1
Upvotes: 2
Reputation: 53861
Use distinct
SELECT DISTINCT * FROM table
Or use group by
select field1,field2,field3 FROM table GROUP BY field1, field2, field3
Upvotes: 3