-- View: pg_j_sites

-- DROP VIEW pg_j_sites;

CREATE OR REPLACE VIEW pg_j_sites AS 
 SELECT pgrel.id_pg, pgrel.pg_nom, pgrel.pg_debut, pgrel.pg_fin, pgrel.pg_statut, pgrel.code_site, sites.libl_site, sites.code_ensemble
   FROM ( SELECT plan_gestion.id_pg, plan_gestion.pg_nom, plan_gestion.pg_debut, plan_gestion.pg_fin, plan_gestion.pg_statut, rel_site_pg.code_site
           FROM plan_gestion
      JOIN sit_rel_site_pg rel_site_pg ON plan_gestion.id_pg = rel_site_pg.id_pg) pgrel, sites
  WHERE pgrel.code_site = sites.code_site;

ALTER TABLE pg_j_sites OWNER TO postgres;
GRANT ALL ON TABLE pg_j_sites TO postgres;
GRANT SELECT, REFERENCES, TRIGGER ON TABLE pg_j_sites TO cpnrc;


