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)
 DISTINCT on 1 column

Author  Topic 

X-Factor
Constraint Violating Yak Guru

392 Posts

Posted - 2003-11-18 : 19:52:28
Hi there,

When using DISTINCT with a SELECT statement, is it possible to have only a single column determine whether the item is a duplicate?

For example,


prodID - variation
4 Pink
4 Green
2 Small
1 Null

I would like to return only...

prodID
4
2
1

X-Factor

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2003-11-18 : 19:54:24
SELECT DISTINCT prodID
FROM Table1

Perhaps I am not understanding the problem.

Tara
Go to Top of Page

X-Factor
Constraint Violating Yak Guru

392 Posts

Posted - 2003-11-18 : 21:03:01
Sorry, my example was poor!

I sorted it out though by not retrieving the data which was causing the duplicates.




Go to Top of Page
   

- Advertisement -