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 |
|
bobross80
Starting Member
11 Posts |
Posted - 2008-03-21 : 18:04:11
|
| SELECT [LastNameOfProfessor], avg(ProfessorRating) AS [Average] FROM [Table1] GROUP BY [LastNameOfProfessor]How would I order this by [Average]? |
|
|
jsmith8858
Dr. Cross Join
7423 Posts |
|
|
jimf
Master Smack Fu Yak Hacker
2875 Posts |
Posted - 2008-03-21 : 18:47:06
|
| you can also order it by [Average]! order by [Average]Jim |
 |
|
|
bobross80
Starting Member
11 Posts |
Posted - 2008-03-21 : 19:29:07
|
quote: Originally posted by jsmith8858 order by avg(professorrating)when in doubt -- try it!- Jeffhttp://weblogs.sqlteam.com/JeffS
Thanks a lot it works, but I thought ordering by an aggregate function is illegal. |
 |
|
|
bobross80
Starting Member
11 Posts |
Posted - 2008-03-21 : 19:30:49
|
quote: Originally posted by jimf you can also order it by [Average]! order by [Average]Jim
The system I'm using will not let me order by an alias for some reason. Thanks though. |
 |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2008-03-21 : 19:36:01
|
| Well you've posted on a Microsoft SQL Server forum, so our answers will be for that system. If you are using a different system, then you should specify that in your initial post.Tara KizerMicrosoft MVP for Windows Server System - SQL Serverhttp://weblogs.sqlteam.com/tarad/ |
 |
|
|
bobross80
Starting Member
11 Posts |
Posted - 2008-03-21 : 20:33:43
|
quote: Originally posted by tkizer Well you've posted on a Microsoft SQL Server forum, so our answers will be for that system. If you are using a different system, then you should specify that in your initial post.Tara KizerMicrosoft MVP for Windows Server System - SQL Serverhttp://weblogs.sqlteam.com/tarad/
I'm using this select command for an asp.net 2.0 webpage and inside a datasource for a grid view control. The webpage is hosted on a ms server and I'm not exactly sure how it's configured/updated. |
 |
|
|
|
|
|