I am using SQLite in java to connect to a database, in the database users will pass some data in and SQLite will return a list of 5 results based on that.
I am unable to figure out a way of teh code using two variables to bring back the closest matching results
The program it self will use Longitude and Latitude to search the database for the 5 closest train stations, and order them nearest to farthest away, my issue is that the Long and Lat will be dynamically input through an android app. so i cannot hard code the Long and Lat
this is my current code
SELECT Latitude, Longitude, StationName FROM stations WHERE Latitude like '51%' AND Longitude like '-3%' LIMIT 5
as you can see for testing the rest of teh code i have used a wildcard and like option to give me teh appearance of it working, however this only gives me an entire list of all of the trainstations in alphabetical order, a realistic lat would be more like 53.4198 and a train station closest to that one could be at 53.4183.
help please