Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.
Hi all, please see this major site announcement: https://www.boards.ie/discussion/2058427594/boards-ie-2026

MySQL get closest value

  • 23-02-2011 09:51PM
    #1
    Registered Users, Registered Users 2 Posts: 55 ✭✭


    Hi guys,

    I have a database with placenames and the latitude and longitude, heres an example:

    ID Placename lat long
    1 Galway 53.4 -9.8
    2 Dublin 53.9 -6.9

    What I want to do is find out the closest place to a certain coordinate, like this:

    Select * from tbl where lat is closest to 53.6 and long is closest to -8.9.

    How would I go about doing this?

    Thanks for helping!


Comments

Advertisement
Advertisement