|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Strange Order on Calculation Field
Hi,
I'm having difficulty with ordering on a calculated field, the order is just not doing what I expect. I'll post the query here, it is a distance calculation based on lat and lng so it quite complex SELECT * , ( ACS( LEAST( 1, CS( 0.898348891269513 ) * CS( - 0.00293599286770486 ) * CS( RADIANS( stations.lat ) ) * CS( RADIANS ( stations.lng ) ) + CS( 0.898348891269513 ) * SIN( - 0.00293599286770486 ) * CS( RADIANS( stations.lat ) ) * SIN( RADIANS ( stations.lng ) ) + SIN( 0.898348891269513 ) * SIN( RADIANS ( stations.lat ) ) ) ) * 3963.19 ) AS distance FRM stations RDER BY `distance` ASC LIMIT 0 , 30 So basically distance is calculated then I just want to order on this, however this is what I get out distance 9.6201 5.1337 12.508 3.5312 2.3165 So I'm confused, what strange kind of ordering is that? Any help much appreciated, |
![]() |
| Viewing: Web Development Archives > Mailing Lists > MYSQL > Strange Order on Calculation Field |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|