Skip to content
Snippets Groups Projects
Commit 8bc7235b authored by Laurent Lecluse's avatar Laurent Lecluse
Browse files

Update V_IMPORT_DEPUIS_DOSSIERS.sql

parent a8893c12
No related branches found
No related tags found
No related merge requests found
CREATE OR REPLACE FORCE VIEW V_IMPORT_DEPUIS_DOSSIERS AS
SELECT
t.annee_id,
t.intervenant_code,
si.code z_statut_id,
t.z_civilite_id,
t.nom_usuel,
t.prenom,
t.date_naissance,
t.nom_patronymique,
t.commune_naissance,
t.z_pays_naissance_id,
t.z_departement_naissance_id,
t.z_pays_nationalite_id,
t.tel_pro,
t.tel_perso,
t.email_pro,
t.email_perso,
t.adresse_precisions,
t.adresse_numero,
t.z_adresse_numero_compl_id,
t.z_adresse_voirie_id,
t.adresse_voie,
t.adresse_voie_lieu_dit,
t.adresse_code_postal,
t.adresse_commune,
t.z_adresse_pays_id,
t.numero_insee,
t.numero_insee_provisoire,
t.iban,
t.bic,
t.rib_hors_sepa,
t.autre_1,
t.autre_2,
t.autre_3,
t.autre_4,
t.autre_5,
t.z_employeur_id
FROM
(
SELECT
i.annee_id annee_id,
i.code intervenant_code,
MIN(ds.ordre) z_statut_ordre,
MAX(cv.libelle_court) z_civilite_id,
MAX(d.nom_usuel) nom_usuel,
MAX(d.prenom) prenom,
......@@ -45,6 +85,7 @@ FROM
JOIN validation v ON v.intervenant_id = i.id
AND v.type_validation_id = tv.id
AND v.histo_destruction IS NULL
JOIN statut_intervenant ds ON ds.id = d.statut_id
JOIN civilite cv ON cv.id = d.civilite_id
LEFT JOIN pays pn ON pn.id = d.pays_naissance_id
LEFT JOIN departement dep ON dep.id = d.departement_naissance_id
......@@ -59,3 +100,5 @@ WHERE
AND si.peut_saisir_dossier = 1
GROUP BY
i.annee_id, i.code
) t
JOIN statut_intervenant si ON si.ordre = t.z_statut_ordre
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment