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
 Transact-SQL (2000)
 Return only non-duplicate rows with select

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2005-01-06 : 08:31:05
me writes "I have a 300,004 rows of data. Each row has one column. Except for two-duplicate values in two sets of rows, all rows are unique. Duplicate values are considered unreliable. I want to select the 300,000 records that are reliable. What is my SQL?"

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2005-01-06 : 08:33:57
select * from
(
select * from myTable
union
select * from myTable
) t

will give you result without duplicates.

or

select col1
from MyTable
group by col1
having count(*)=1

will give you result without those that are doubled.

Go with the flow & have fun! Else fight the flow
Go to Top of Page
   

- Advertisement -