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.

    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`
order by `dist`

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.