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 |
|
biggs
Starting Member
10 Posts |
Posted - 2006-02-08 : 21:43:10
|
| Is it possible to order by a value in a field? For example, let's say you want to return all books sorted by LastName, but you want books written by 'Orwell' to show up first in your output.Just curious.Tony |
|
|
Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)
7020 Posts |
Posted - 2006-02-08 : 22:56:06
|
| [code]select *from MyTableorder by case LastName when 'Orwell' then 0 else 1 end, LastName[/code]CODO ERGO SUM |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2006-02-09 : 01:48:14
|
orselect *from MyTableorder by case when LastName ='Orwell' then 1 else 2 end MadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|