-- View: mf.vu_histo_surftot_par_site

-- DROP VIEW mf.vu_histo_surftot_par_site;

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

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

