postgresql - How to get matching data from other table? -
using postgres, have 2 tables:
the first called territories columns sid, agent , postcode.
the second called postcodes, columns id, postcode , geometry.
how can put geometry column data table postcodes table territories matching postcode?
in query:
select t.*, p.geometry territories t left join postcodes p on t.postcode=p.postcode
thats works if there not duplicateds postcodes in postcodes table.
if want update table territories, first add column , update it:
update territories t set geometry = p.geometry postcodes p t.postcode=p.postcode
Comments
Post a Comment