Perhaps the join between FEATURES
and County
orFEATURES
and State
is excluding the results you expect to see? Try changing it to a left join
and see if you get the expected results:
SELECT * FROM Features
LEFT JOIN County ON Features.COUNTY_NUMERIC = County.COUNTYFP
LEFT JOIN State ON Features.STATE_NUMERIC = State.STATEFP
WHERE (County.COUNTYFP = 45) AND (State.STATEFP = 6)
UPDATE:
Based on your update – The County table has a column StateId that links us back to the State table.
Could the issue be that you should be joining County
and State
instead of County
and FEATURES
? Example:
SELECT * FROM Features
INNER JOIN County ON Features.COUNTY_NUMERIC = County.COUNTYFP
INNER JOIN State ON County.STATE_NUMERIC = State.STATEFP
WHERE (County.COUNTYFP = 45) AND (State.STATEFP = 6)