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 Query Problem

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2003-05-28 : 07:48:54
Dush writes "original data :
uid id number
espioneer 1 10
espioneer 1 20
espioneer 2 10
espioneer 2 20
espioneer 2 30
espioneer 3 10
espioneer 4 10
espioneer1 4 10


I want to only obtain these data: (distinct id with all other fields)
uid id number
espioneer 1 10
espioneer 2 10
espioneer 3 10
espioneer 4 10

I tried many ways but came closest using this statement:

SELECT * FROM CustDetails
WHERE id IN (SELECT distinct id FROM dbo.CustDetails where
uid = 'espioneer')

Please help!
Thank You."

mr_mist
Grunnio

1870 Posts

Posted - 2003-05-28 : 08:27:08
select distinct uid, [id], min (number) from #moo where uid ='espioneer' group by uid, [id]

-------
Moo.
Go to Top of Page
   

- Advertisement -