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 |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2001-09-13 : 08:20:44
|
| Aisha Fenton writes "Hi,I have been trying to order a result-set alphanumerically but with a specified item placed first in the ordering.For examples I wanted to have an order like-----------top_itemaaabbbccc-----------I came up with the following query, which does just this, but no one at my work (and we have some SQL gurus) could explain to me why? In fact they where all quite stunned that it was even valid syntax.------------SELECT nameFROM itemsORDER BY (SELECT name WHERE name NOT LIKE 'top_item'), name-------------This produces a result-set ordered by whether or not the item is 'top_item' and then alphanumerically. But why does it work? I thought "Order by" could only take column names?I am using SQL Server 7.0Thanks,Aisha Fenton" |
|
|
|
|
|