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
 Select and make Other sorted in the last

Author  Topic 

calvinkwoo3000
Yak Posting Veteran

98 Posts

Posted - 2011-12-15 : 02:45:55
My table
ID Description
1 NULL
2 DHL
3 FEDEX
4 UPS
5 OTHER
6 TNT

how do i select and make the OTHER sort in the last position?

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2011-12-15 : 02:50:05
[code]
ORDER BY case when [Description] = 'OTHER' then 2 else 1 end, ID
[/code]


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

Go to Top of Page

calvinkwoo3000
Yak Posting Veteran

98 Posts

Posted - 2011-12-15 : 04:06:15
quote:
Originally posted by khtan


ORDER BY case when [Description] = 'OTHER' then 2 else 1 end, ID



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





Bravo, thank you so much khtan....
this is what i want and you are very helpful...

Thank you and thank for SQLteam.com and the master here....
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2011-12-15 : 08:05:44
welcome


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

Go to Top of Page
   

- Advertisement -