Welcome to WebmasterWorld Guest from 126.96.36.199
Forum Moderators: open
Table #1 = geocoding
Table #2 = stores
What I basically am trying to do is have a search box on a page that looks up a zipcode (zipid) from the geocoding table. It then finds the 4 closest stores (store1,store2,store3,store4 in the geocoding table)
Then I want to display the info from the stores table that corresponds to the store1,store2,store3,store4 fields from that specific zipid (Store name, address,city,state,zip,phone,fax,email,website,owners name)
Im really lost as to how to write that sql statement?
In the Geocode table I have these fields:
id, ZipdId, Store1, Store2, Store3, Store4 (and a couple more that we dont need to use)
In the stores table I have these fields:
storeNum (this is the number that would appear in the store1-4 fields in the geocode table), storename,address1, address2, city, state, zip, country, phone, fax, email, website, owner
Any help would be greatly appreciated. Im using an access db, with asp btw.
As for my mind, the newbie in SQl it has to be so.
If its the same thing then you could maybe use a query like this;
select * from stores
where storenum in (select store1,store2,store3,store4 from geocoding where zipId=@myZip)
IMO the way to do this feature professionally is to store the longtitue and lattitude values for your zip codes and write code to work out the distance between two zip codes.