Mysql
 sql >> Database >  >> RDS >> Mysql

Come nascondere una colonna alias in mysql EDITED

Vorresti usare una sottoquery:

select wp_id
from (select cl.wp_id,( 3959 * acos( cos( radians(12.91841) ) * cos( radians( y(gproperty) ) ) * 
             cos( radians( x(gproperty)) - radians(77.58631) ) + sin( radians(12.91841) ) * 
             sin( radians(y(gproperty) ) ) ) ) AS distance
      from db1.geofeature gf join
           db2.c_loc cl 
           on gf.o_type = 256 and cl.c_info_id = 146 and gf.o_id = cl.wp_id
    ) t
where distance < 10
order by distance
limit 10;

Si noti che ho anche corretto la sintassi dei join per utilizzare i join espliciti.