Are you using "Tiger" or some other zip-distance data sources?  If so,
not all zipcodes show up in their lists.  We've had the same problem
here.


-----Original Message-----
From: Phill B [mailto:[EMAIL PROTECTED] 
Sent: Friday, January 28, 2005 13:07
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.



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Stay Ahead of Hackers - Download ZoneAlarm Pro
http://www.houseoffusion.com/banners/view.cfm?bannerid=65

Message: http://www.houseoffusion.com/lists.cfm/link=i:6:2097
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

Reply via email to