Код: Выделить всё
SELECT *, ATAN(SQRT(POW(COS(RADIANS(latitude)) * SIN(ABS(RADIANS(-111.8147)-RADIANS(longitude))),2) + POW(
COS(RADIANS(41.692)) * SIN(RADIANS(latitude)) - SIN(RADIANS(41.692))
* COS(RADIANS(latitude))*COS(ABS(RADIANS(-111.8147)-RADIANS(longitude)))
,2))/(SIN(RADIANS(latitude))*SIN(RADIANS(41.692)) +
COS(RADIANS(latitude))*COS(RADIANS(41.692))*
COS(ABS(RADIANS(-111.8147)-RADIANS(longitude))))) * 6373 AS `distance` FROM table WHERE `distance` < 1000
Код: Выделить всё
#1054 - Unknown column 'distance' in 'where clause'
В чем баг не пойму?
-- добавлено 16 мар 2012, 23:03 --
вопрос решен использовал HAVING