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 |
|
m1k3ch3ck
Starting Member
7 Posts |
Posted - 2012-06-08 : 07:22:07
|
| i have an assumption and i'd like to see if i am correct:"order by n" orders my query by the selected value number n, e.g.:select name, age, color...order by 1>> orderes (alphabetic) by name...order by 2>> orderes (numeric) by age...order by 3>> orderes (alphabetic) by colorquestion:is this correct ? |
|
|
sunitabeck
Master Smack Fu Yak Hacker
5155 Posts |
Posted - 2012-06-08 : 07:38:26
|
quote: Originally posted by m1k3ch3ck i have an assumption and i'd like to see if i am correct:"order by n" orders my query by the selected value number n, e.g.:select name, age, color...order by 1>> orderes (alphabetic) by name...order by 2>> orderes (numeric) by age...order by 3>> orderes (alphabetic) by colorquestion:is this correct ?
Yes, if name and color are character type columns and age is numeric type column. If age were to be character type, the ordering would be alphanumeric for that.When you specify order by n, it simply is telling SQL Server to order it by the n'th column in in the select list. |
 |
|
|
m1k3ch3ck
Starting Member
7 Posts |
Posted - 2012-06-08 : 07:39:17
|
| thx |
 |
|
|
|
|
|