-- View: spatial."vu_bdp_comun_I_sites"

-- DROP VIEW spatial."vu_bdp_comun_I_sites";

CREATE OR REPLACE VIEW spatial."vu_bdp_comun_I_sites" AS 
 SELECT DISTINCT ON (bdp_commune.gid) bdp_commune.gid, sites_emprise.codsit, sites_emprise.nom_site, bdp_commune.code_insee, bdp_commune.nom_com, bdp_commune.geom
   FROM spatial.bdp_commune, spatial.sites_emprise
  WHERE st_overlaps(bdp_commune.geom, sites_emprise.geom)
  ORDER BY bdp_commune.gid;

ALTER TABLE spatial."vu_bdp_comun_I_sites" OWNER TO ludodo;
GRANT ALL ON TABLE spatial."vu_bdp_comun_I_sites" TO ludodo;
GRANT ALL ON TABLE spatial."vu_bdp_comun_I_sites" TO geomatique;
GRANT SELECT ON TABLE spatial."vu_bdp_comun_I_sites" TO cpnrc;

