Cheat Sheet

Monday, October 31, 2016

Update column for st contains

ALTER TABLE  public.tcm_centre
 add column kod_negeri char(2),
 add column par_id smallint,
 add column dun_id integer,
 add column no_dun smallint;
 
update tcm_centre g set (kod_negeri, par_id, dun_id, no_dun) = (SELECT f.kod_negeri, f.par_id, f.dun_id, f.no_dun FROM 
tcm_centre, (SELECT d.kod_negeri, d.par_id, d.dun_id, d.no_dun, d.geom FROM dun d) as f WHERE ST_CONTAINS(f.geom, g.geom) aND 
tcm_centre.gid = g.gid)

No comments:

Post a Comment