I'm trying to join two PostGIS table, one of DMAs and another of states.
After getting some help, I ran this query:
CREATE TABLE combined AS SELECT nextval('polyseq_1') AS id, b.name AS state_name, a.dma_1 AS dma_1, CASE WHEN ST_Within(a.geom, b.geom) THEN a.geom ELSE...