Try something like this <!-- language: sql --> SELECT DISTINCT ON (boundary.id) boundary.* FROM boundary, location WHERE ST_Intersects (boundary.geom, location.geom) [paul ramsey made an improvement, but forgot the I in ID]