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)
 Select all based on distinct row ?

Author  Topic 

loiter99
Starting Member

38 Posts

Posted - 2004-05-11 : 14:24:32
Hello,
I have a table that is just riddled with dups. The problem is that there is a date/time stamp to contend with and also a column that has null for 5 elements that is actually unique for all 5.

I want to use a temp table to remove them and repopulate the table. Is it possible to select all the rows based on a unique value of one of the columns?

For example:

select * from dups
where unique column has a disctinct value ??

Hope I am making myself clear.

TIA.
J

X002548
Not Just a Number

15586 Posts

Posted - 2004-05-11 : 14:35:12
Post the DDL and some sample data...

It'll be something like

SELECT * FROM mytable99 o
WHERE EXISTS (
SELECT Col1 FROM myTable99 i
WHERE o.Col1 = i.Col1
GROUP BY Col1
HAVING COUNT(*) > 1)



Brett

8-)
Go to Top of Page
   

- Advertisement -