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

Popular posts from this blog

Spring Boot + JPA + Hibernate: Unable to locate persister -

go - Golang: panic: runtime error: invalid memory address or nil pointer dereference using bufio.Scanner -

c - double free or corruption (fasttop) -