Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQL Query and Calculations 1

Status
Not open for further replies.

gpalmer711

IS-IT--Management
May 11, 2001
2,445
GB
Hi All,

I wasn't sure whether this should have gone in the SQL group or this one so if you think i'm in the wrong place let me know.

I have a asp.net site that is basically a site for hosting the details of certain venues which people can search for. I'm currently implementing a feature that will allow people to search for venues that are within a certain distance of their location.

I essentially have to code working for this feature, I have the longitudes and latitudes of all the venues in the database and also the longitudes and latitudes of all the postcodes in the uk in another table. A user puts in their postcode and it will first pick out the lat and long of the postcode and then calculate the distance between the venue and the postcode (as the crow flys).

Now there may be as many as 3000 venues in the system within the next few months so what would be the best way of going through all of the records to calculate the distances?

The two thoughts I have had are to go through the records one at a time, calculate the distance and if it is within the required distance add it to a recordset to be desplayed once all the records are checked.

Or

Write a SQL query that checks the distance on the fly. I'm not even sure if this is possible.

If you have any thoughts I would appreciate it.


Greg Palmer
Freeware Utilities for Windows Administrators.
 
Write a SQL query that checks the distance on the fly. I'm not even sure if this is possible.
I'd go with this option. It is possible to work this out with the info you have and it shouldn't take a long time to do it as part of your SQL query. The relevant SQL forum should be able to help you out if you get any problems with the query.


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
As always a speedy and helpful response - I'll do some reading on advanced SQL queries and see where I get.

Thanks

Greg Palmer
Freeware Utilities for Windows Administrators.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top