I have a query that calculate distance from point a to point b using gps coordinates, and would like to make it view.
Is it posible to pass variables that will replace xxx and yyy in my query with variables passed from outside of view?
Here's query.
select
round((((degrees(acos(((sin(radians(xxx)) * sin(radians(`ag_regija_hr`.`lat`))) +
((cos(radians(xxx)) * cos(radians(`ag_regija_hr`.`lat`))) *
cos(radians((yyy - `ag_regija_hr`.`lng`))))))) * 60) * 1.1515) * 1.609344), 2) AS `dist`
from
`ag_regija_hr`
order by `dist`
Best Answer
check out this one: https://stackoverflow.com/questions/2281890/can-i-create-view-with-parameter-in-mysql
ot you can crate sp for this select http://dev.mysql.com/doc/refman/5.0/en/create-procedure.html