-- View: mf.vu_surftot_par_site

-- DROP VIEW mf.vu_surftot_par_site;

CREATE OR REPLACE VIEW mf.vu_surftot_par_site AS 
 SELECT parcelle.code_site, sites.libl_site, count(parcelle.code_site) AS nb_parcel, sum(parcelle.surface) AS tot_surf
   FROM mf.parcelle, sites
  WHERE parcelle.code_site::bpchar = sites.code_site::bpchar
  GROUP BY parcelle.code_site, sites.libl_site
  ORDER BY parcelle.code_site;

ALTER TABLE mf.vu_surftot_par_site OWNER TO ludodo;
GRANT ALL ON TABLE mf.vu_surftot_par_site TO ludodo;
GRANT ALL ON TABLE mf.vu_surftot_par_site TO geomatique;
GRANT SELECT, REFERENCES, TRIGGER ON TABLE mf.vu_surftot_par_site TO public;
GRANT SELECT, REFERENCES, TRIGGER ON TABLE mf.vu_surftot_par_site TO cpnrc;

