NYCPlanning / db-acs

American Community Survey data processing for Population Fact Finder
4 stars 1 forks source link

Potential typo with P and E variables in Cv variable #9

Closed AmandaDoyle closed 4 years ago

baolingz commented 4 years ago
WITH tmp AS(
SELECT a.geotype, a.geoid, a.c, a.e, a.m, a.p, a.z, a.variable, b.c, b.e, b.m, b.p, b.z
FROM housing a
RIGHT JOIN staging.housing b
ON a.geotype = b.geotype
AND a.geogname = b.geogname
AND a.geoid = b.geoid
AND a.dataset = b.dataset
AND a.variable = b.variable
WHERE (b.e = b.p
AND b.e IS NOT NULL
AND a.p != b.p)
OR (b.m = b.z
AND b.m IS NOT NULL
AND a.z != b.z
)
)
SELECT geotype, variable, COUNT(*) FROM tmp
GROUP BY geotype, variable
ORDER BY COUNT(*) DESC;
SPTKL commented 4 years ago

see https://github.com/NYCPlanning/db-acs/issues/10