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
 General SQL Server Forums
 New to SQL Server Programming
 distinct

Author  Topic 

eem_2055
Yak Posting Veteran

69 Posts

Posted - 2008-01-28 : 23:55:11
Hi Guys,,
want I need your help

I have the ff records:
Customer
ID CustNo Name Type
10 1 Madonna R
10 2 Madonna R


I used the ff query

select distinct(ID), CustNo, name,type
from Customer
where Type = 'R'
order by Name
but the result is wrong.

I want this result:
10 2 Madonna R

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2008-01-29 : 00:05:45
[code]select ID, max(CustNo), Name, Type
from Customer
group by ID, Name, Type[/code]


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

eem_2055
Yak Posting Veteran

69 Posts

Posted - 2008-01-29 : 02:10:34
tnx a lot
Go to Top of Page
   

- Advertisement -