I do not see in your SQL where you are using the ZIP code in the database as part of the query. It would seem that you want to limit by the passed zip codes (in the where clause) and use the ZIP code in the database in the calculations rather than the passed zip codes.
Ray Thompson Tau Beta Pi (www.tbp.org) The Engineering Honor Society 865-546-4578 -----Original Message----- From: Phill B [mailto:[EMAIL PROTECTED] Sent: Friday, January 28, 2005 2:07 PM To: SQL Subject: zip code search problems I have a query that gets the lat and long for a zip. I then pass that to another query that finds zip codes within a range. The problem is that some zip codes you search for don't show but others do. Ugh! I don't even know where to start looking to fix the problem. Any suggestion? Is there better math to use? Here is a sample of my sql. SELECT lat, long, name, city, state, zipcode, 3963 * (ACOS((SIN(#passedzip.lat#/57.2958) * SIN(lat/57.2958)) + (COS(#passedzip.lat#/57.2958) * COS(lat/57.2958) * COS(long/57.2958 - #passedzip.long#/57.2958)))) AS distance FROM dealers_geo WHERE 3963 * (ACOS((SIN(#passedzip.lat#/57.2958) * SIN(lat/57.2958)) + (COS(#passedzip.lat#/57.2958) * COS(lat/57.2958) * COS(long/57.2958 - #passedzip.long#/57.2958)))) <= #attributes.passedradius# ORDER BY distance -- Phillip B. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Find out how CFTicket can increase your company's customer support efficiency by 100% http://www.houseoffusion.com/banners/view.cfm?bannerid=49 Message: http://www.houseoffusion.com/lists.cfm/link=i:6:2096 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/6 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:6 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.6 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54
