Forum OpenACS Development: Re: ec_location_based_on_zip_code

Collapse
Posted by Torben Brosten on

Jon (or anyone else),

Is this an optimally formed query, considering it is a join of the 3 reference tables?

 select s.abbrev, z.name, c.name
 from us_zipcodes z, us_states s, us_counties c
 where  z.fips_state_code = s.fips_state_code and
        z.fips_county_code = c.fips_county_code and
        z.fips_state_code = c.fips_state_code and
        z.zipcode=:zip_code;

It is to replace this query for the non-existant table:

    	select state_code, city_name, county_name
      	from zip_codes
     	where zip_code=:zip_code;

Torben