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.
Author |
Topic |
sandeepkashaboina
Starting Member
1 Post |
Posted - 2011-09-16 : 11:17:01
|
After executing the query I got the following data:select pkid, firstname from customer order by firstnamepkid firstname4 Name15 Name23 Name31 Sandeep6 Name3But I need the result as following:pkid firstname1 Sandeep4 Name15 Name23 Name36 Name3'Sandeep' should always come first:something like: select pkid, firstname from customer order by 'sandeep', firstnameHelp needed !!Thanks. |
|
ehorn
Master Smack Fu Yak Hacker
1632 Posts |
Posted - 2011-09-16 : 11:21:10
|
Hello,Perhaps you could use a CASE statement in the ORDER BY clause. Something like;ORDER BY CASE WHEN firstname = 'SanDeep' THEN 'A' ELSE firstname END ASC, pkid ASC HTH. |
|
|
russell
Pyro-ma-ni-yak
5072 Posts |
Posted - 2011-09-16 : 11:23:26
|
order by case when firstname = 'Sandeep' then 0 else 1 end, firstname |
|
|
|
|
|