Last active
April 15, 2016 09:27
-
-
Save pigreco/5a5931b4bea49cc9555ed458c5fad42c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- la tua tabella | |
id integer NOT NULL DEFAULT nextval('comuni_id_seq'::regclass), | |
geom geometry(MultiPolygon,32633), | |
cod_reg integer, | |
cod_pro integer, | |
pro_com integer, | |
nome_com character varying(58), | |
nome_ted character varying(100), | |
CONSTRAINT comuni_pkey PRIMARY KEY (id) | |
-- query | |
CREATE OR REPLACE VIEW centroidi AS | |
SELECT id, nome_com, st_centroid (comuni.geom) AS geom | |
FROM comuni; | |
-- vista con join - dove: v_centroidi è la vista precedentemente creata; | |
-- ho fatto un join tra la vista e la tabella | |
create or replace view v_professionistigisita as | |
SELECT | |
v_centroidi_com.gid, | |
v_centroidi_com.nome_com, | |
v_centroidi_com.geom, | |
nomi_citta.id, | |
nomi_citta."Nome e Cognome", | |
nomi_citta."Città" | |
FROM | |
public.v_centroidi_com | |
INNER JOIN | |
public.nomi_citta | |
ON | |
v_centroidi_com.nome_com = nomi_citta."Città"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment