Created
June 20, 2018 15:07
-
-
Save franc3000/ea983385008b16f84b73a42e2a6e6071 to your computer and use it in GitHub Desktop.
zipcode research
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
select a.fips, b.zipcode, count_n, cities, p_50_sqft, p_50_estval | |
from ( | |
select fips, zipcode, cast(sum(n) as unsigned) count_n -- cast to int, otherwise decimal | |
from feature_fips_zips_counts | |
where fips = '48453' | |
and sfr=1 | |
group by 1,2 | |
) a | |
left join feature_tax_zipcode_city b | |
on a.zipcode=b.zipcode | |
left join ( | |
select zipcode, p_50 p_50_sqft | |
from feature_aggregate_tax_zipcode z | |
where z.feature='square_footage' | |
) y | |
on a.zipcode=y.zipcode | |
left join ( | |
select zipcode, p_50 p_50_estval | |
from feature_aggregate_tax_zipcode z | |
where z.feature='estimated_value' | |
) z | |
on a.zipcode=z.zipcode | |
where a.fips = '48453' | |
and b.zipcode is not null | |
-- and sfr=1 | |
group by 1, 2; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment