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 - 2005-08-15 : 07:43:05
|
| Eric Moore writes "I have this query: select mycolumn, count(mycolumn) as mycolcountfrom mytableI want to be able to order by the count, however, this is an aggregate field? How do I do this?" |
|
|
robvolk
Most Valuable Yak
15732 Posts |
Posted - 2005-08-15 : 07:43:33
|
| Yes, you can do that:select mycolumn, count(mycolumn) as mycolcountfrom mytableorder by count(mycolumn) |
 |
|
|
mmarovic
Aged Yak Warrior
518 Posts |
Posted - 2005-08-15 : 11:11:49
|
orselect mycolumn, count(mycolumn) as mycolcountfrom mytableorder by 2 |
 |
|
|
|
|
|