Sign up ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

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`
share|improve this question

1 Answer 1

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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