ERROR: syntax error at or near ")" LINE 1: ....id = buildings.neighborhood_id WHERE (units.id = ) AND (uni... ^