Question : Advanced Query (Lat and Lon) - Spatial Operation

Hello,

I am in need of an advanced query that will assist us with a project we are working on.  

I will have a table (ROUTE table) containing a list of locations that a gps unit should visit in a single day.  These records will have associated lat/lon coordinates.

Lastly, I will have a table (ACTUAL table) containing the actual lat/lon coordinates of a gps unit stored by date and time.

I need to query (I am told Spatial Operations will be necessary) the "ACTUAL" table for any records that are within 1/8 of a mile from ANY of the records in the "ROUTE" table.  

If there ARE records that show the GPS unit within 1/8 of a mile I need to show what time it arrived, and if there AREN'T then I need to indicate that the GPS unit failed to arrive at that location.

How can I do this in such a way that it DOESN'T overload the DB and doesn't take forever to retrieve results?  Thank you!

Answer : Advanced Query (Lat and Lon) - Spatial Operation

The main difference is that I sort of calculated the distance as a field that is returned in the result and your statement uses it for filtering only. If you don't need the distance in the result, your approach is fine :-)
Random Solutions  
 
programming4us programming4us