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 |
|
mortoleeuk
Starting Member
5 Posts |
Posted - 2007-11-30 : 12:24:25
|
Hi,I have a query which returns decimals.i want to return in an order which is based on how close the value is to a particular value.So for the following results:5.475.6010.001.50 I want to return them in order of closest to 6.00 so it would return this instead...5.60 closest to 6.00 (0.40 away)5.47 (0.53 away)1.50 (3.50 away)10.00 furthest from 6.00 (4.00 away) Thanks for your help.Cheers,Lee |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2007-11-30 : 12:52:30
|
| Table1Value5.475.6010.001.50SELECT Value,(Value-6) AS 'ordervalue'FROM TableORDER BY ordervalue |
 |
|
|
|
|
|