Site Sponsored By: SQLDSC - SQL Server Desired State Configuration
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.
I want to use this select statement to find these id's in this order15, 12, 34,44,2. How can you do this?
select * from FDOH_Navigation where id in (15,12,34,44,2)
sodeep
Master Smack Fu Yak Hacker
7174 Posts
Posted - 2009-02-02 : 16:56:31
[code]select * from FDOH_NavigationWhere id in (15,12,34,44,2)Order by (Case When id = 15 then 0 When id = 12 then 1 When id = 34 then 2 When id = 44 then 3 When id = 2 then 4 Else id End)[/code]