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
 disinct sort

Author  Topic 

shanmugaraj
Posting Yak Master

219 Posts

Posted - 2006-03-29 : 01:19:26
when i use

select Employer_Number from employers order by len(Employer_Number) , Employer_Number
i get the repeated Employer_Number
so i tried

select distinct Employer_Number from employers order by len(Employer_Number) , Employer_Number
select Employer_Number from employers order by len(Employer_Number) , Employer_Number
group by Employer_Number

but i cannot use. can you tell me how to select distinct of employernumber

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2006-03-29 : 01:26:06
This query should be fine.
select distinct Employer_Number from employers order by len(Employer_Number) , Employer_Number


It should be SELECT .. FROM .. GROUP BY .. ORDER BY
select Employer_Number from employers 
group by Employer_Number
order by len(Employer_Number) , Employer_Number




KH

Choice is an illusion, created between those with power, and those without.
Concordantly, while your first question may be the most pertinent, you may or may not realize it is also the most irrelevant

Go to Top of Page

shanmugaraj
Posting Yak Master

219 Posts

Posted - 2006-03-29 : 01:39:29
Thanks khtan ,i have got the required answer.. keep in touch
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-03-29 : 01:42:31
>>but i cannot use.

Why?
Did you get errors?

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

shanmugaraj
Posting Yak Master

219 Posts

Posted - 2006-03-29 : 02:02:36
mr. madhivanan

select Employer_Number from employers
group by Employer_Number
order by len(Employer_Number) , Employer_Number

is working
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-03-29 : 02:26:54
I am referring the code you post at your question

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -