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-17 : 08:16:18
|
| Peter writes "What if you have a table, for example States, with population, square miles, etc. and you want to query the table and order the query by a derived value, such as populationDensity = pop/squareMiles, or anything like that, which isn't a column in the table but can be derived from the information in two columns. Is it possible in SQL to write something likeSELECT * FROM States ORDER BY (pop/squareMiles)?ThanksPeter" |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2005-08-17 : 08:21:54
|
| Have a seperate column in the querySelect * from (Select columns,(pop/squareMiles) as mycol from yourtable)T order by mycolMadhivananFailing to plan is Planning to fail |
 |
|
|
mmarovic
Aged Yak Warrior
518 Posts |
Posted - 2005-08-18 : 06:17:02
|
| Yes, it is. Why didn't you just run that and saw if it worked? |
 |
|
|
|
|
|