Files
aduzuki/sql.sql
2026-07-20 16:33:04 +02:00

1059 lines
44 KiB
SQL

-- ADD 0 in ca_decompte_place
INSERT INTO ca_decompte_place
VALUES (1,"2024/2025", "2023-11-13 13:50:34",0,0,0,0,0,0,0,0,0,0,0,0,0);
SELECT * FROM ca_decompte_place
-- TROUVER DOUBLON
SELECT COUNT(identifiant) AS nbr_doublon, identifiant
FROM adherent
GROUP BY identifiant
HAVING COUNT(identifiant) > 1
-- CONCERTISTES QUI N'EST PAS DANS CA_ADHERENT
SELECT * FROM `ca_concertiste` WHERE ca_concertiste.identifiant NOT IN (SELECT identifiant FROM ca_adherent where ca_adherent.commande_nb_concertiste>0)
--CLE UNIQUE
-- voir les cles
SHOW INDEX FROM tbl_name
-- suprimer clé
DROP INDEX index_name ON tbl_name
-- double
ALTER TABLE mytable ADD UNIQUE my_unique_index(field1,field2);
--------------------
--------------------
-- CONCERT
--------------------
--------------------
-- PAIEMENT EN ATTENTE
SELECT * FROM `ca_adherent` WHERE ca_adherent.stripe_statut_paiement = "attente"
-- FINANCE
-- TOTAL CONCERT
SELECT sum(ca_adherent.commande_cout_spectateur + ca_adherent.commande_cout_concertiste) AS TOTAL_CONCERT FROM ca_adherent
SELECT sum(ca_adherent.don) AS TOTAL_DON FROM ca_adherent
SELECT sum(ca_adherent.montant_total) AS TOTAL_GENERAL FROM ca_adherent
--------------------
-- COMPTEUR DE PLACES :
-- ENCADRANT
-- PROF
SELECT count(ca_encadrant.identifiant) AS PROF_NB FROM ca_encadrant
WHERE
ca_encadrant.encadrant_type="Professeur"
-- Parent
SELECT count(ca_encadrant.identifiant) AS PAR_NB FROM ca_encadrant
WHERE
ca_encadrant.encadrant_type="Parent"
-- SPECTATEUR : nombre de spectateur qui a payé
SELECT sum(ca_adherent.commande_nb_spectateur) FROM `ca_adherent`
-- CONCERTISTE : nombre de concertiste qui a payé
SELECT sum(ca_adherent.commande_nb_concertiste) FROM `ca_adherent` WHERE ca_adherent.stripe_statut_paiement="paye"
-- Table concertiste qui a paye
-- Tout instrument
SELECT count(ca_concertiste.concertiste_intrument) AS nb_concertiste
FROM ca_concertiste
LEFT JOIN ca_adherent ON ca_concertiste.identifiant = ca_adherent.identifiant
WHERE ca_adherent.stripe_statut_paiement = "paye"
-- Compte par instrument
-- piano
SELECT count(ca_concertiste.concertiste_intrument) AS piano_nb
FROM ca_concertiste
LEFT JOIN ca_adherent ON ca_concertiste.identifiant = ca_adherent.identifiant
WHERE ca_concertiste.concertiste_intrument = "Piano"
AND ca_adherent.stripe_statut_paiement = "paye"
-- violon 1
SELECT count(ca_concertiste.concertiste_intrument) AS violon_1_nb
FROM ca_concertiste
LEFT JOIN ca_adherent ON ca_concertiste.identifiant = ca_adherent.identifiant
WHERE ca_concertiste.concertiste_intrument = "Violon"
AND (ca_concertiste.concertiste_cahier = "Cahier 1" OR ca_concertiste.concertiste_cahier = "Cahier 2" OR ca_concertiste.concertiste_cahier = "Cahier 3" OR ca_concertiste.concertiste_cahier = "Cahier 4" OR ca_concertiste.concertiste_cahier = "Cahier 5")
AND ca_adherent.stripe_statut_paiement = "paye"
-- violon 2
SELECT count(ca_concertiste.concertiste_intrument) AS violon_2_nb
FROM ca_concertiste
LEFT JOIN ca_adherent ON ca_concertiste.identifiant = ca_adherent.identifiant
WHERE ca_concertiste.concertiste_intrument = "Violon"
AND (ca_concertiste.concertiste_cahier = "Cahier 6" OR ca_concertiste.concertiste_cahier = "Cahier 7" OR ca_concertiste.concertiste_cahier = "Cahier 8" OR ca_concertiste.concertiste_cahier = "Cahier 9" OR ca_concertiste.concertiste_cahier = "Cahier 10")
AND ca_adherent.stripe_statut_paiement = "paye"
-- violoncelle 1
SELECT count(ca_concertiste.concertiste_intrument) AS violoncelle_1_nb
FROM ca_concertiste
LEFT JOIN ca_adherent ON ca_concertiste.identifiant = ca_adherent.identifiant
WHERE ca_concertiste.concertiste_intrument = "Violoncelle"
AND (ca_concertiste.concertiste_cahier = "Cahier 1" OR ca_concertiste.concertiste_cahier = "Cahier 2" OR ca_concertiste.concertiste_cahier = "Cahier 3" OR ca_concertiste.concertiste_cahier = "Cahier 4")
AND ca_adherent.stripe_statut_paiement = "paye"
-- violoncelle 2
SELECT count(ca_concertiste.concertiste_intrument) AS violoncelle_2_nb
FROM ca_concertiste
LEFT JOIN ca_adherent ON ca_concertiste.identifiant = ca_adherent.identifiant
WHERE ca_concertiste.concertiste_intrument = "Violoncelle"
AND (ca_concertiste.concertiste_cahier = "Cahier 5" OR ca_concertiste.concertiste_cahier = "Cahier 6" OR ca_concertiste.concertiste_cahier = "Cahier 7" OR ca_concertiste.concertiste_cahier = "Cahier 8" OR ca_concertiste.concertiste_cahier = "Cahier 9" OR ca_concertiste.concertiste_cahier = "Cahier 10")
AND ca_adherent.stripe_statut_paiement = "paye"
-- Trompette
SELECT count(ca_concertiste.concertiste_intrument) AS Trompette_nb
FROM ca_concertiste
LEFT JOIN ca_adherent ON ca_concertiste.identifiant = ca_adherent.identifiant
WHERE ca_concertiste.concertiste_intrument = "Trompette"
AND ca_adherent.stripe_statut_paiement = "paye"
-- Alto
SELECT count(ca_concertiste.concertiste_intrument) AS Alto_nb
FROM ca_concertiste
LEFT JOIN ca_adherent ON ca_concertiste.identifiant = ca_adherent.identifiant
WHERE ca_concertiste.concertiste_intrument = "Alto"
AND ca_adherent.stripe_statut_paiement = "paye"
-- Flute
SELECT count(ca_concertiste.concertiste_intrument) AS Flute_nb
FROM ca_concertiste
LEFT JOIN ca_adherent ON ca_concertiste.identifiant = ca_adherent.identifiant
WHERE ca_concertiste.concertiste_intrument = "Flute"
AND ca_adherent.stripe_statut_paiement = "paye"
-- Harpe
SELECT count(ca_concertiste.concertiste_intrument) AS Harpe_nb
FROM ca_concertiste
LEFT JOIN ca_adherent ON ca_concertiste.identifiant = ca_adherent.identifiant
WHERE ca_concertiste.concertiste_intrument = "Harpe"
AND ca_adherent.stripe_statut_paiement = "paye"
-- TRIGGERS
-----------------------------------------------------------------
-----------------------------------------------------------------
-- CALCULER LE NOMBRE DE BILLETS VENDUS PAR WEEZEVENT DANS LA TABLE ca_adherent
-- APRÈS INSERTION DES BILLETS DEPUIS L'API WEEZEVENT
-- USER LOCAL root@localhost
-- UNE REQUÊTE PAR CATÉGORIE DE BILLET
-- SPECTATEUR
CREATE TRIGGER `compteur_spectateur` AFTER INSERT ON `weez_unesco_participants`
FOR EACH ROW UPDATE ca_adherent,
(select
weez_unesco_participants.numero_adherent , COUNT(weez_unesco_participants.numero_adherent) AS compteur
from weez_unesco_participants
WHERE weez_unesco_participants.categorie = "Spectateur"
GROUP BY weez_unesco_participants.numero_adherent)
AS toto
SET ca_adherent.achatweez_nb_spectateur = toto.compteur
WHERE ca_adherent.identifiant = toto.numero_adherent
-- Élève musicien
CREATE TRIGGER `compteur_musicien` AFTER INSERT ON `weez_unesco_participants`
FOR EACH ROW UPDATE ca_adherent,
(select
weez_unesco_participants.numero_adherent , COUNT(weez_unesco_participants.numero_adherent) AS compteur
from weez_unesco_participants
WHERE weez_unesco_participants.categorie = "Élève musicien"
GROUP BY weez_unesco_participants.numero_adherent)
AS toto
SET ca_adherent.achatweez_nb_concertiste = toto.compteur
WHERE ca_adherent.identifiant = toto.numero_adherent
-- Parent encadrant
CREATE TRIGGER `compteur_parent_encadrant` AFTER INSERT ON `weez_unesco_participants`
FOR EACH ROW UPDATE ca_adherent,
(select
weez_unesco_participants.numero_adherent , COUNT(weez_unesco_participants.numero_adherent) AS compteur
from weez_unesco_participants
WHERE weez_unesco_participants.categorie = "Parent encadrant"
GROUP BY weez_unesco_participants.numero_adherent)
AS toto
SET ca_adherent.achatweez_nb_encadr_par = toto.compteur
WHERE ca_adherent.identifiant = toto.numero_adherent
-- Professeur encadrant
CREATE TRIGGER `compteur_prof_encadrant` AFTER INSERT ON `weez_unesco_participants`
FOR EACH ROW UPDATE ca_adherent,
(select
weez_unesco_participants.numero_adherent , COUNT(weez_unesco_participants.numero_adherent) AS compteur
from weez_unesco_participants
WHERE weez_unesco_participants.categorie = "Professeur encadrant"
GROUP BY weez_unesco_participants.numero_adherent)
AS toto
SET ca_adherent.achatweez_nb_encadr_prof = toto.compteur
WHERE ca_adherent.identifiant = toto.numero_adherent
---------------------------------
--ANCIENNES
-- SPECTATEUR
CREATE TRIGGER `spectateur` AFTER INSERT ON `weez_unesco_participants`
FOR EACH ROW FOLLOWS `compteur_spectateur` UPDATE ca_adherent,
(select weez_unesco_participants.numero_adherent,
CASE
WHEN ca_adherent.precommande_nb_spectateur = COUNT(weez_unesco_participants.numero_adherent) THEN 'identique'
ELSE 'different spectateur'
END AS state
from ca_adherent
LEFT JOIN weez_unesco_participants ON ca_adherent.identifiant = weez_unesco_participants.numero_adherent
WHERE weez_unesco_participants.categorie = "Spectateur"
GROUP BY ca_adherent.identifiant, weez_unesco_participants.numero_adherent,ca_adherent.precommande_nb_spectateur)
AS toto
SET ca_adherent.status_weezevent = toto.state
WHERE ca_adherent.identifiant = toto.numero_adherent
-- Élève musicien
CREATE TRIGGER `musicien` AFTER INSERT ON `weez_unesco_participants`
FOR EACH ROW FOLLOWS `compteur_musicien` UPDATE ca_adherent,
(select weez_unesco_participants.numero_adherent,
CASE
WHEN ca_adherent.precommande_nb_concertiste = COUNT(weez_unesco_participants.numero_adherent) THEN 'identique / '
ELSE 'different concertiste / '
END AS state
from ca_adherent
LEFT JOIN weez_unesco_participants ON ca_adherent.identifiant = weez_unesco_participants.numero_adherent
WHERE weez_unesco_participants.categorie = "Élève musicien" AND ca_adherent.identifiant = weez_unesco_participants.numero_adherent
GROUP BY ca_adherent.identifiant, weez_unesco_participants.numero_adherent,ca_adherent.precommande_nb_concertiste)
AS toto
SET ca_adherent.status_weezevent=concat(ca_adherent.status_weezevent, toto.state)
WHERE ca_adherent.identifiant = toto.numero_adherent
-- Parent encadrant
CREATE TRIGGER `parent_encadrant` AFTER INSERT ON `weez_unesco_participants`
FOR EACH ROW FOLLOWS `compteur_parent_encadrant` UPDATE ca_adherent,
(select weez_unesco_participants.numero_adherent,
CASE
WHEN ca_adherent.precommande_nb_encadr_par = COUNT(weez_unesco_participants.numero_adherent) THEN 'identique'
ELSE 'different_encadr_par'
END AS state
from ca_adherent
LEFT JOIN weez_unesco_participants ON ca_adherent.identifiant = weez_unesco_participants.numero_adherent
WHERE weez_unesco_participants.categorie = "Parent encadrant"
GROUP BY ca_adherent.identifiant, weez_unesco_participants.numero_adherent,ca_adherent.precommande_nb_encadr_par)
AS toto
SET ca_adherent.status_weezevent = toto.state
WHERE ca_adherent.identifiant = toto.numero_adherent
-- Professeur encadrant
CREATE TRIGGER `prof_encadrant` AFTER INSERT ON `weez_unesco_participants`
FOR EACH ROW FOLLOWS `compteur_prof_encadrant` UPDATE ca_adherent,
(select weez_unesco_participants.numero_adherent,
CASE
WHEN ca_adherent.precommande_nb_encadr_prof = COUNT(weez_unesco_participants.numero_adherent) THEN 'identique'
ELSE 'different_encadr_prof'
END AS state
from ca_adherent
LEFT JOIN weez_unesco_participants ON ca_adherent.identifiant = weez_unesco_participants.numero_adherent
WHERE weez_unesco_participants.categorie = "Professeur encadrant"
GROUP BY ca_adherent.identifiant, weez_unesco_participants.numero_adherent,ca_adherent.precommande_nb_encadr_prof)
AS toto
SET ca_adherent.status_weezevent = toto.state
WHERE ca_adherent.identifiant = toto.numero_adherent
ca_adherent.status_weezevent=concat(ca_adherent.status_weezevent, toto.state)
-- VÉRIFIER QUE LA COMMANDE SUR LE FORMULAIR CORRESPOND AU NOMBRE DE BILLETS ACHETÉS SUR WEEZEVENT
UPDATE ca_adherent
SET ca_adherent.status_weezevent = "different"
WHERE (precommande_nb_spectateur <> achatweez_nb_spectateur)
OR (precommande_nb_concertiste <> achatweez_nb_concertiste)
OR (precommande_nb_encadr_par <> achatweez_nb_encadr_par)
OR (precommande_nb_encadr_prof <> achatweez_nb_encadr_prof)
UPDATE ca_adherent
SET ca_adherent.status_weezevent = "identique"
WHERE (precommande_nb_spectateur = achatweez_nb_spectateur)
AND (precommande_nb_concertiste = achatweez_nb_concertiste)
AND (precommande_nb_encadr_par = achatweez_nb_encadr_par)
AND (precommande_nb_encadr_prof = achatweez_nb_encadr_prof)
-- METTRE À JOUR SUITE À AJOUT DE BILLET POUR PERSONNE DÉJA INSCRITE
UPDATE ca_adherent
SET date_maj
---------------------------------------------
---------------------------------------------
-- DÉCHARGEMENT DES DONNÉES DANS GOOGLE SHEET
-- MODULE CONCERT ANNUEL
---------------------------------------------
---------------------------------------------
-- ONGLET concertistes
SELECT
ca_concertiste.saison,
ca_concertiste.identifiant,
ca_concertiste.date_maj,
ca_concertiste.concertiste_nom,
ca_concertiste.concertiste_prenom,
ca_concertiste.concertiste_age,
ca_concertiste.concertiste_intrument,
ca_concertiste.concertiste_cahier,
ca_concertiste.concertiste_piece,
ca_concertiste.concertiste_prof_nom,
ca_concertiste.concertiste_prof_mail,
ca_adherent.statut_paiement,
ca_adherent.status_weezevent,
ca_adherent.adherent_telephone_mobile,
ca_adherent.adherent_mail
FROM ca_concertiste
LEFT JOIN ca_adherent ON ca_concertiste.identifiant = ca_adherent.identifiant
WHERE ca_concertiste.gsheet <> "true" OR ca_concertiste.gsheet IS NULL
-- ONGLET encadrants
SELECT
ca_encadrant.saison,
ca_encadrant.identifiant,
ca_encadrant.date_maj,
ca_encadrant.encadrant_type,
ca_encadrant.encadrant_nom,
ca_encadrant.encadrant_prenom,
ca_encadrant.encadrant__telephone_mobile,
ca_encadrant.encadrant_mail,
ca_encadrant.encadrant__prof_instrument,
ca_adherent.status_weezevent
FROM ca_encadrant
LEFT JOIN ca_adherent ON ca_encadrant.identifiant = ca_adherent.identifiant
WHERE ca_encadrant.gsheet <> "true" OR ca_encadrant.gsheet IS NULL
---------------------------------------------
---------------------------------------------
-- DÉCHARGEMENT DES DONNÉES DANS GOOGLE SHEET
-- MODULE ADHESION
---------------------------------------------
---------------------------------------------
-- Réinitialiser les chargements
UPDATE adherent SET gsheet = NULL;
UPDATE adherent_eleve SET gsheet = NULL;
UPDATE adherent_finance SET gsheet = NULL;
UPDATE adherent_formation_prof SET gsheet = NULL;
UPDATE adherent_professeur SET gsheet = NULL;
UPDATE adherent_finance SET gs_adherent_att = NULL;
-- MAJ ONGLET adherent
select
adherent.date_maj,
adherent.saison,
adherent.identifiant,
adherent.association_suzuki,
adherent.adherent_type,
adherent.adherent_nom,
adherent.adherent_prenom,
adherent.adherent_telephone_mobile,
adherent.adherent_mail,
adherent.adherent_adresse_rue,
adherent.adherent_adresse_complement,
adherent.adherent_adresse_codepostal,
adherent.adherent_adresse_ville,
adherent.adherent_adresse_pays,
adherent.adherent_telephone_fixe,
adherent.carte_envoi,
adherent_finance.statut_paiement
FROM adherent
INNER JOIN adherent_finance ON adherent_finance.identifiant = adherent.identifiant
WHERE
(adherent.gsheet = '' OR adherent.gsheet IS NULL)
AND adherent_finance.statut_paiement = 'paye'
-- adherent TAGUER DB COMME DÉCHARGÉE DANS GOOGLE SHEET
UPDATE adherent
SET gsheet = "' + now + '"
WHERE identifiant = "' + results[i].identifiant + '"
-- MAJ ONGLET professeurs
SELECT
adherent_professeur.date_maj,
adherent_professeur.saison,
adherent_professeur.identifiant,
adherent_professeur.association_suzuki,
adherent_professeur.adherent_nom,
adherent_professeur.adherent_prenom,
adherent_professeur.adherent_mail,
adherent_professeur.adherent_telephone_mobile,
adherent_professeur.adherent_prof_instrument1,
adherent_professeur.adherent_prof_instrument1_esa,
adherent_professeur.adherent_prof_instrument2,
adherent_professeur.adherent_prof_instrument2_esa,
adherent_professeur.adherent_prof_sece,
adherent_professeur.adherent_prof_ecole1,
adherent_professeur.adherent_prof_ecole1_mail,
adherent_professeur.adherent_prof_ecole1_web,
adherent_professeur.adherent_prof_ecole1_adresse,
adherent_professeur.adherent_prof_ecole1_cp,
adherent_professeur.adherent_prof_ecole1_ville,
adherent_professeur.adherent_prof_ecole2,
adherent_professeur.adherent_prof_ecole2_mail,
adherent_professeur.adherent_prof_ecole2_web,
adherent_professeur.adherent_prof_ecole2_adresse,
adherent_professeur.adherent_prof_ecole2_cp,
adherent_professeur.adherent_prof_ecole2_ville,
adherent_professeur.adherent_prof_ecole3,
adherent_professeur.adherent_prof_ecole3_mail,
adherent_professeur.adherent_prof_ecole3_web,
adherent_professeur.adherent_prof_ecole3_adresse,
adherent_professeur.adherent_prof_ecole3_cp,
adherent_professeur.adherent_prof_ecole3_ville,
adherent_finance.statut_paiement
FROM adherent_professeur
INNER JOIN adherent_finance ON adherent_finance.identifiant = adherent_professeur.identifiant
WHERE
(adherent_professeur.gsheet = '' OR adherent_professeur.gsheet IS NULL)
AND adherent_finance.statut_paiement = 'paye'
-- professeurs TAGUER DB COMME DÉCHARGÉE DANS GOOGLE SHEET
UPDATE adherent_professeur
SET gsheet = "' + now + '"
WHERE identifiant = "' + results3[i].identifiant + '"
-- MAJ ONGLET professeurs_stagiaires
SELECT
adherent_formation_prof.date_maj,
adherent_formation_prof.saison,
adherent_formation_prof.identifiant,
adherent_formation_prof.association_suzuki,
adherent_formation_prof.adherent_nom,
adherent_formation_prof.adherent_prenom,
adherent_formation_prof.adherent_mail,
adherent_formation_prof.adherent_telephone_mobile,
adherent_formation_prof.adherent_prof_stagiaire_instrument1,
adherent_formation_prof.adherent_prof_stagiaire_instrument1_esa,
adherent_formation_prof.adherent_prof_stagiaire_instrument1_prof,
adherent_formation_prof.adherent_prof_stagiaire_instrument2,
adherent_formation_prof.adherent_prof_stagiaire_instrument2_esa,
adherent_formation_prof.adherent_prof_stagiaire_instrument2_prof,
adherent_finance.statut_paiement
FROM adherent_formation_prof
INNER JOIN adherent_finance ON adherent_finance.identifiant = adherent_formation_prof.identifiant
WHERE
(adherent_formation_prof.gsheet = '' OR adherent_formation_prof.gsheet IS NULL)
AND adherent_finance.statut_paiement = 'paye'
-- professeurs_stagiaires TAGUER DB COMME DÉCHARGÉE DANS GOOGLE SHEET
UPDATE adherent_formation_prof
SET gsheet = "' + now + '"
WHERE identifiant = "' + results5[i].identifiant + '"
-- MAJ ONGLET élèves
SELECT
adherent_eleve.date_maj,
adherent_eleve.saison,
adherent_eleve.identifiant,
adherent_eleve.association_suzuki,
adherent_eleve.eleve_nom,
adherent_eleve.eleve_prenom,
adherent_eleve.adherent_mail,
adherent_eleve.adherent_telephone_mobile,
adherent_eleve.eleve_datenaissance,
adherent_eleve.eleve_instrumentA,
adherent_eleve.eleve_instrumentA_cahier,
adherent_eleve.eleve_instrumentA_prof,
adherent_eleve.eleve_instrumentB,
adherent_eleve.eleve_instrumentB_cahier,
adherent_eleve.eleve_instrumentB_prof,
adherent_eleve.eleve_droitimage,
adherent_eleve.eleve_contactsup_nom,
adherent_eleve.eleve_contactsup_prenom,
adherent_eleve.eleve_contactsup_mail,
adherent_finance.statut_paiement
FROM adherent_eleve
INNER JOIN adherent_finance ON adherent_finance.identifiant = adherent_eleve.identifiant
WHERE
(adherent_eleve.gsheet = '' OR adherent_eleve.gsheet IS NULL)
AND adherent_finance.statut_paiement = 'paye'
-- élèves TAGUER DB COMME DÉCHARGÉE DANS GOOGLE SHEET
UPDATE adherent_eleve
SET gsheet = "' + now + '"
where identifiant = "' + results7[i].identifiant + '"
-- MAJ ONGLET finances
SELECT
adherent_finance.date_maj,
adherent_finance.saison,
adherent_finance.identifiant,
adherent_finance.association_suzuki,
adherent_finance.adherent_type,
adherent_finance.adherent_nom,
adherent_finance.adherent_prenom,
adherent_finance.adherent_telephone_mobile,
adherent_finance.adherent_mail,
adherent_finance.montant_adhesion,
adherent_finance.montant_don,
adherent_finance.montant_total,
adherent_finance.paiement_mode,
adherent_finance.date_paiement,
adherent_finance.stripe_retour,
adherent_finance.cheque_banque,
adherent_finance.cheque_numero,
adherent_finance.statut_paiement
FROM adherent_finance
WHERE
(adherent_finance.gsheet = '' OR adherent_finance.gsheet IS NULL)
AND adherent_finance.statut_paiement = 'paye'
WHERE (adherent_finance.gsheet = '' OR adherent_finance.gsheet IS NULL) AND adherent_finance.statut_paiement = 'paye'
-- finances TAGUER DB COMME DÉCHARGÉE DANS GOOGLE SHEET
UPDATE adherent_finance
SET gsheet = "' + now + '"
WHERE identifiant = "' + results9[i].identifiant + '"
-- MAJ ONGLET adherent_en_attente
SELECT
adherent_finance.date_maj,
adherent_finance.saison,
adherent_finance.identifiant,
adherent_finance.association_suzuki,
adherent_finance.adherent_type,
adherent_finance.adherent_nom,
adherent_finance.adherent_prenom,
adherent_finance.adherent_telephone_mobile,
adherent_finance.adherent_mail,
adherent_finance.montant_adhesion,
adherent_finance.montant_don,
adherent_finance.montant_total,
adherent_finance.paiement_mode,
adherent_finance.date_paiement,
adherent_finance.stripe_retour,
adherent_finance.cheque_banque,
adherent_finance.cheque_numero,
adherent_finance.statut_paiement
FROM adherent_finance
WHERE
(adherent_finance.gs_adherent_att = '' OR adherent_finance.gs_adherent_att IS NULL)
AND (adherent_finance.statut_paiement <> 'paye' OR adherent_finance.statut_paiement IS NULL OR adherent_finance.statut_paiement = '')
-- adherent_en_attente TAGUER DB COMME DÉCHARGÉE DANS GOOGLE SHEET
UPDATE adherent_finance
SET gs_adherent_att = "' + now + '"
WHERE identifiant = "' + results11[i].identifiant + '"
---------------------------------------------
---------------------------------------------
-- METTRE À JOUR LE STATUS DE PAIEMENT
-- MANUELLEMENT
---------------------------------------------
---------------------------------------------
SELECT
adherent.adherent_type,
adherent.adherent_adresse_rue,
adherent.adherent_adresse_codepostal,
adherent.adherent_adresse_ville,
adherent.adherent_nom,
adherent.adherent_prenom,
adherent.adherent_mail
FROM adherent
WHERE
adherent.identifiant = req.session.maj_identifiant
SELECT adherent.adherent_type, adherent.adherent_adresse_rue, adherent.adherent_adresse_codepostal, adherent.adherent_adresse_ville, adherent.adherent_nom, adherent.adherent_prenom, adherent.adherent_mail FROM adherent WHERE adherent.identifiant = req.session.maj_identifiant
---------------------------------------------
---------------------------------------------
-- SUPPRESSION D'UN ADHERENT
-- MANUELLEMENT
---------------------------------------------
---------------------------------------------
UPDATE adherent SET identifiant = "supprime", date_maj = "'+now+'", identifiant_supprime = "'+req.session.supp_identifiant+'" WHERE identifiant = "'+req.session.supp_identifiant+'";
UPDATE adherent_eleve SET identifiant = "supprime", date_maj = "'+now+'", identifiant_supprime = "'+req.session.supp_identifiant+'" WHERE identifiant = "'+req.session.supp_identifiant+'";
UPDATE adherent_finance SET identifiant = "supprime", date_maj = "'+now+'", identifiant_supprime = "'+req.session.supp_identifiant+'" WHERE identifiant = "'+req.session.supp_identifiant+'";
UPDATE adherent_formation_prof SET identifiant = "supprime", date_maj = "'+now+'", identifiant_supprime = "'+req.session.supp_identifiant+'" WHERE identifiant = "'+req.session.supp_identifiant+'";
UPDATE adherent_professeur SET identifiant = "supprime", date_maj = "'+now+'", identifiant_supprime = "'+req.session.supp_identifiant+'" WHERE identifiant = "'+req.session.supp_identifiant+'";
---------------------------------------------
---------------------------------------------
-- ASSOCIATIONS LOCACLES
-- IMPORTS ADHÉRENTS DANS DB
---------------------------------------------
---------------------------------------------
association_suzuki,
saison,
identifiant,
date_maj,
adherent_type,
adherent_nom,
adherent_prenom,
adherent_adresse_rue,
adherent_adresse_complement,
adherent_adresse_codepostal,
adherent_adresse_ville,
adherent_adresse_pays,
adherent_telephone_fixe,
adherent_telephone_mobile,
adherent_mail
GS_asso_locales_rows[i].association,
GS_asso_locales_rows[i].saison,
GS_asso_locales_rows[i].identifiant,
GS_asso_locales_rows[i].adhesion_date,
GS_asso_locales_rows[i].adherent_type,
GS_asso_locales_rows[i].adherent_nom,
GS_asso_locales_rows[i].adherent_prenom,
GS_asso_locales_rows[i].adherent_adresse_rue,
GS_asso_locales_rows[i].adherent_adresse_complement,
GS_asso_locales_rows[i].adherent_adresse_codepostal,
GS_asso_locales_rows[i].adherent_adresse_ville,
GS_asso_locales_rows[i].adherent_adresse_pays,
GS_asso_locales_rows[i].adherent_telephone_fixe,
GS_asso_locales_rows[i].adherent_telephone_mobile,
GS_asso_locales_rows[i].adherent_mail
adherent_finance
date_maj
saison
identifiant
association_suzuki
adherent_type
adherent_nom
adherent_prenom
adherent_telephone_mobile
adherent_mail
statut_paiement
paiement_mode
date_paiement
montant_adhesion
montant_don
montant_total
now,
GS_asso_locales_rows[i].saison,
GS_asso_locales_rows[i].identifiant,
GS_asso_locales_rows[i].association,
GS_asso_locales_rows[i].adherent_type,
GS_asso_locales_rows[i].adherent_nom,
GS_asso_locales_rows[i].adherent_prenom,
GS_asso_locales_rows[i].adherent_telephone_mobile,
GS_asso_locales_rows[i].adherent_mail,
GS_asso_locales_rows[i].adhesion_paye,
GS_asso_locales_rows[i].adherent_paiement_mode,
now,
GS_asso_locales_rows[i].adherent_paiement_montant_adhesion,
GS_asso_locales_rows[i].adherent_paiement_montant_don,
GS_asso_locales_rows[i].adherent_paiement_montant_total
date_maj, saison, identifiant, association_suzuki, adherent_type, adherent_nom, adherent_prenom, adherent_telephone_mobile, adherent_mail, statut_paiement, paiement_mode, date_paiement, montant_adhesion, montant_don, montant_total
INSERT INTO adherent
(association_suzuki, saison, identifiant, date_maj, adherent_type, adherent_nom, adherent_prenom, adherent_adresse_rue, adherent_adresse_complement, adherent_adresse_codepostal, adherent_adresse_ville, adherent_adresse_pays, adherent_telephone_fixe, adherent_telephone_mobile, adherent_mail)
VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)
INSERT INTO adherent_finance
(date_maj, saison, identifiant, association_suzuki, adherent_type, adherent_nom, adherent_prenom, adherent_telephone_mobile, adherent_mail, statut_paiement, paiement_mode, date_paiement, montant_adhesion, montant_don, montant_total)
VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)
INSERT INTO adherent_finance (date_maj, saison, identifiant, association_suzuki, adherent_type, adherent_nom, adherent_prenom, adherent_telephone_mobile, adherent_mail, statut_paiement, paiement_mode, date_paiement, montant_adhesion, montant_don, montant_total) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)
now, GS_asso_locales_rows[i].saison, GS_asso_locales_rows[i].identifiant, GS_asso_locales_rows[i].association, GS_asso_locales_rows[i].adherent_type, GS_asso_locales_rows[i].adherent_nom, GS_asso_locales_rows[i].adherent_prenom, GS_asso_locales_rows[i].adherent_telephone_mobile, GS_asso_locales_rows[i].adherent_mail, GS_asso_locales_rows[i].adhesion_paye, GS_asso_locales_rows[i].adherent_paiement_mode, now, GS_asso_locales_rows[i].adherent_paiement_montant_adhesion, GS_asso_locales_rows[i].adherent_paiement_montant_don, GS_asso_locales_rows[i].adherent_paiement_montant_total
INSERT INTO adherent_professeur
(date_maj, saison, identifiant, association_suzuki, adherent_nom, adherent_prenom, adherent_telephone_mobile, adherent_mail, adherent_prof_instrument1, adherent_prof_instrument1_esa, adherent_prof_instrument2, adherent_prof_instrument2_esa, adherent_prof_sece, adherent_prof_ecole1, adherent_prof_ecole1_adresse, adherent_prof_ecole1_cp, adherent_prof_ecole1_ville, adherent_prof_ecole1_mail, adherent_prof_ecole1_web, adherent_prof_ecole2, adherent_prof_ecole2_adresse, adherent_prof_ecole2_cp, adherent_prof_ecole2_ville, adherent_prof_ecole2_mail, adherent_prof_ecole2_web, adherent_prof_ecole3, adherent_prof_ecole3_adresse, adherent_prof_ecole3_cp, adherent_prof_ecole3_ville, adherent_prof_ecole3_mail, adherent_prof_ecole3_web)
VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)
date_maj,
saison,
identifiant,
association_suzuki,
adherent_nom,
adherent_prenom,
adherent_telephone_mobile,
adherent_mail,
adherent_prof_instrument1,
adherent_prof_instrument1_esa,
adherent_prof_instrument2,
adherent_prof_instrument2_esa,
adherent_prof_sece,
adherent_prof_ecole1,
adherent_prof_ecole1_adresse,
adherent_prof_ecole1_cp,
adherent_prof_ecole1_ville,
adherent_prof_ecole1_mail,
adherent_prof_ecole1_web,
adherent_prof_ecole2,
adherent_prof_ecole2_adresse,
adherent_prof_ecole2_cp,
adherent_prof_ecole2_ville,
adherent_prof_ecole2_mail,
adherent_prof_ecole2_web,
adherent_prof_ecole3,
adherent_prof_ecole3_adresse,
adherent_prof_ecole3_cp,
adherent_prof_ecole3_ville,
adherent_prof_ecole3_mail,
adherent_prof_ecole3_web
now,
GS_asso_locales_rows[i].saison,
GS_asso_locales_rows[i].identifiant,
GS_asso_locales_rows[i].association,
GS_asso_locales_rows[i].adherent_nom,
GS_asso_locales_rows[i].adherent_prenom,
GS_asso_locales_rows[i].adherent_telephone_mobile,
GS_asso_locales_rows[i].adherent_mail,
GS_asso_locales_rows[i].adherent_prof_instrument1,
GS_asso_locales_rows[i].adherent_prof_instrument1_esa,
GS_asso_locales_rows[i].adherent_prof_instrument2,
GS_asso_locales_rows[i].adherent_prof_instrument2_esa,
GS_asso_locales_rows[i].adherent_prof_sece,
GS_asso_locales_rows[i].adherent_prof_ecole1,
GS_asso_locales_rows[i].adherent_prof_ecole1_adresse,
GS_asso_locales_rows[i].adherent_prof_ecole1_cp,
GS_asso_locales_rows[i].adherent_prof_ecole1_ville,
GS_asso_locales_rows[i].adherent_prof_ecole1_mail,
GS_asso_locales_rows[i].adherent_prof_ecole1_web,
GS_asso_locales_rows[i].adherent_prof_ecole2,
GS_asso_locales_rows[i].adherent_prof_ecole2_adresse,
GS_asso_locales_rows[i].adherent_prof_ecole2_cp,
GS_asso_locales_rows[i].adherent_prof_ecole2_ville,
GS_asso_locales_rows[i].adherent_prof_ecole2_mail,
GS_asso_locales_rows[i].adherent_prof_ecole2_web,
GS_asso_locales_rows[i].adherent_prof_ecole3,
GS_asso_locales_rows[i].adherent_prof_ecole3_adresse,
GS_asso_locales_rows[i].adherent_prof_ecole3_cp,
GS_asso_locales_rows[i].adherent_prof_ecole3_ville,
GS_asso_locales_rows[i].adherent_prof_ecole3_mail,
GS_asso_locales_rows[i].adherent_prof_ecole3_web,
now, GS_asso_locales_rows[i].saison, GS_asso_locales_rows[i].identifiant, GS_asso_locales_rows[i].association, GS_asso_locales_rows[i].adherent_nom, GS_asso_locales_rows[i].adherent_prenom, GS_asso_locales_rows[i].adherent_telephone_mobile, GS_asso_locales_rows[i].adherent_mail, GS_asso_locales_rows[i].adherent_prof_instrument1, GS_asso_locales_rows[i].adherent_prof_instrument1_esa, GS_asso_locales_rows[i].adherent_prof_instrument2, GS_asso_locales_rows[i].adherent_prof_instrument2_esa, GS_asso_locales_rows[i].adherent_prof_sece, GS_asso_locales_rows[i].adherent_prof_ecole1, GS_asso_locales_rows[i].adherent_prof_ecole1_adresse, GS_asso_locales_rows[i].adherent_prof_ecole1_cp, GS_asso_locales_rows[i].adherent_prof_ecole1_ville, GS_asso_locales_rows[i].adherent_prof_ecole1_mail, GS_asso_locales_rows[i].adherent_prof_ecole1_web, GS_asso_locales_rows[i].adherent_prof_ecole2, GS_asso_locales_rows[i].adherent_prof_ecole2_adresse, GS_asso_locales_rows[i].adherent_prof_ecole2_cp, GS_asso_locales_rows[i].adherent_prof_ecole2_ville, GS_asso_locales_rows[i].adherent_prof_ecole2_mail, GS_asso_locales_rows[i].adherent_prof_ecole2_web, GS_asso_locales_rows[i].adherent_prof_ecole3, GS_asso_locales_rows[i].adherent_prof_ecole3_adresse, GS_asso_locales_rows[i].adherent_prof_ecole3_cp, GS_asso_locales_rows[i].adherent_prof_ecole3_ville, GS_asso_locales_rows[i].adherent_prof_ecole3_mail, GS_asso_locales_rows[i].adherent_prof_ecole3_web
INSERT INTO adherent_formation_prof
(date_maj, saison, identifiant, association_suzuki, adherent_nom, adherent_prenom, adherent_telephone_mobile, adherent_mail, adherent_prof_stagiaire_instrument1, adherent_prof_stagiaire_instrument1_prof, adherent_prof_stagiaire_instrument1_esa, adherent_prof_stagiaire_instrument2, adherent_prof_stagiaire_instrument2_prof, adherent_prof_stagiaire_instrument2_esa)
VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?)
date_maj,
saison,
identifiant,
association_suzuki,
adherent_nom,
adherent_prenom,
adherent_telephone_mobile,
adherent_mail,
adherent_prof_stagiaire_instrument1,
adherent_prof_stagiaire_instrument1_prof,
adherent_prof_stagiaire_instrument1_esa,
adherent_prof_stagiaire_instrument2,
adherent_prof_stagiaire_instrument2_prof,
adherent_prof_stagiaire_instrument2_esa
now,
GS_asso_locales_rows[i].saison,
GS_asso_locales_rows[i].identifiant,
GS_asso_locales_rows[i].association,
GS_asso_locales_rows[i].adherent_nom,
GS_asso_locales_rows[i].adherent_prenom,
GS_asso_locales_rows[i].adherent_telephone_mobile,
GS_asso_locales_rows[i].adherent_mail,
GS_asso_locales_rows[i].adherent_prof_stagiaire_instrument1,
GS_asso_locales_rows[i].adherent_prof_stagiaire_instrument1_prof,
GS_asso_locales_rows[i].adherent_prof_stagiaire_instrument1_esa,
GS_asso_locales_rows[i].adherent_prof_stagiaire_instrument2,
GS_asso_locales_rows[i].adherent_prof_stagiaire_instrument2_prof,
GS_asso_locales_rows[i].adherent_prof_stagiaire_instrument2_esa
INSERT INTO adherent_eleve
(date_maj, saison, identifiant, association_suzuki, adherent_telephone_mobile, adherent_mail, eleve_nom, eleve_prenom, eleve_datenaissance, eleve_contactsup_nom, eleve_contactsup_prenom, eleve_contactsup_mail, eleve_instrumentA, eleve_instrumentA_prof, eleve_instrumentA_cahier, eleve_instrumentB, eleve_instrumentB_prof, eleve_instrumentB_cahier, eleve_droitimage)
VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,)
date_maj,
saison,
identifiant,
association_suzuki,
adherent_telephone_mobile,
adherent_mail,
eleve_nom,
eleve_prenom,
eleve_datenaissance,
eleve_contactsup_nom,
eleve_contactsup_prenom,
eleve_contactsup_mail,
eleve_instrumentA,
eleve_instrumentA_prof,
eleve_instrumentA_cahier,
eleve_instrumentB,
eleve_instrumentB_prof,
eleve_instrumentB_cahier,
eleve_droitimage
now,
GS_asso_locales_rows[i].saison,
GS_asso_locales_rows[i].identifiant,
GS_asso_locales_rows[i].association,
GS_asso_locales_rows[i].adherent_telephone_mobile,
GS_asso_locales_rows[i].adherent_mail,
GS_asso_locales_rows[i].adherent_eleve1_nom,
GS_asso_locales_rows[i].adherent_eleve1_prenom,
GS_asso_locales_rows[i].adherent_eleve1_datenaissance,
GS_asso_locales_rows[i].adherent_eleve1_contactsup_nom,
GS_asso_locales_rows[i].adherent_eleve1_contactsup_prenom,
GS_asso_locales_rows[i].adherent_eleve1_contactsup_mail,
GS_asso_locales_rows[i].adherent_eleve1_InstrumentA,
GS_asso_locales_rows[i].adherent_eleve1_InstrumentA_prof,
GS_asso_locales_rows[i].adherent_eleve1_InstrumentA_cahier,
GS_asso_locales_rows[i].adherent_eleve1_InstrumentB,
GS_asso_locales_rows[i].adherent_eleve1_InstrumentB_prof,
GS_asso_locales_rows[i].adherent_eleve1_InstrumentB_cahier,
GS_asso_locales_rows[i].adherent_eleve1_droitimage
now, GS_asso_locales_rows[i].saison, GS_asso_locales_rows[i].identifiant, GS_asso_locales_rows[i].association, GS_asso_locales_rows[i].adherent_telephone_mobile, GS_asso_locales_rows[i].adherent_mail, GS_asso_locales_rows[i].adherent_eleve1_nom, GS_asso_locales_rows[i].adherent_eleve1_prenom, GS_asso_locales_rows[i].adherent_eleve1_datenaissance, GS_asso_locales_rows[i].adherent_eleve1_contactsup_nom, GS_asso_locales_rows[i].adherent_eleve1_contactsup_prenom, GS_asso_locales_rows[i].adherent_eleve1_contactsup_mail, GS_asso_locales_rows[i].adherent_eleve1_InstrumentA, GS_asso_locales_rows[i].adherent_eleve1_InstrumentA_prof, GS_asso_locales_rows[i].adherent_eleve1_InstrumentA_cahier, GS_asso_locales_rows[i].adherent_eleve1_InstrumentB, GS_asso_locales_rows[i].adherent_eleve1_InstrumentB_prof, GS_asso_locales_rows[i].adherent_eleve1_InstrumentB_cahier, GS_asso_locales_rows[i].adherent_eleve1_droitimage
SELECT
adherent.date_maj,
adherent.saison,
adherent.identifiant,
adherent.association_suzuki,
adherent.adherent_type,
adherent.adherent_nom,
adherent.adherent_prenom,
adherent.adherent_telephone_mobile,
adherent.adherent_mail,
adherent.adherent_adresse_rue,
adherent.adherent_adresse_complement,
adherent.adherent_adresse_codepostal,
adherent.adherent_adresse_ville,
adherent.adherent_adresse_pays,
adherent.adherent_telephone_fixe,
adherent.carte_envoi,
adherent_finance.statut_paiement
FROM adherent
INNER JOIN adherent_finance ON adherent_finance.identifiant = adherent.identifiant
WHERE (adherent.gsheet = '' OR adherent.gsheet IS NULL)
AND adherent_finance.statut_paiement = 'paye'";
SELECT
adherent_professeur.date_maj,
adherent_professeur.saison,
adherent_professeur.identifiant,
adherent_professeur.association_suzuki,
adherent_professeur.adherent_nom,
adherent_professeur.adherent_prenom,
adherent_professeur.adherent_mail,
adherent_professeur.adherent_telephone_mobile,
adherent_professeur.adherent_prof_instrument1,
adherent_professeur.adherent_prof_instrument1_esa,
adherent_professeur.adherent_prof_instrument2,
adherent_professeur.adherent_prof_instrument2_esa,
adherent_professeur.adherent_prof_sece,
adherent_professeur.adherent_prof_ecole1,
adherent_professeur.adherent_prof_ecole1_mail,
adherent_professeur.adherent_prof_ecole1_web,
adherent_professeur.adherent_prof_ecole1_adresse,
adherent_professeur.adherent_prof_ecole1_cp,
adherent_professeur.adherent_prof_ecole1_ville,
adherent_professeur.adherent_prof_ecole2,
adherent_professeur.adherent_prof_ecole2_mail,
adherent_professeur.adherent_prof_ecole2_web,
adherent_professeur.adherent_prof_ecole2_adresse,
adherent_professeur.adherent_prof_ecole2_cp,
adherent_professeur.adherent_prof_ecole2_ville,
adherent_professeur.adherent_prof_ecole3,
adherent_professeur.adherent_prof_ecole3_mail,
adherent_professeur.adherent_prof_ecole3_web,
adherent_professeur.adherent_prof_ecole3_adresse,
adherent_professeur.adherent_prof_ecole3_cp,
adherent_professeur.adherent_prof_ecole3_ville,
adherent_finance.statut_paiement
FROM adherent_professeur
INNER JOIN adherent_finance ON adherent_finance.identifiant = adherent_professeur.identifiant
WHERE (adherent_professeur.gsheet = '' OR adherent_professeur.gsheet IS NULL)
AND adherent_finance.statut_paiement = 'paye'";
SELECT
adherent_formation_prof.date_maj,
adherent_formation_prof.saison,
adherent_formation_prof.identifiant,
adherent_formation_prof.association_suzuki,
adherent_formation_prof.adherent_nom,
adherent_formation_prof.adherent_prenom,
adherent_formation_prof.adherent_mail,
adherent_formation_prof.adherent_telephone_mobile,
adherent_formation_prof.adherent_prof_stagiaire_instrument1,
adherent_formation_prof.adherent_prof_stagiaire_instrument1_esa,
adherent_formation_prof.adherent_prof_stagiaire_instrument1_prof,
adherent_formation_prof.adherent_prof_stagiaire_instrument2,
adherent_formation_prof.adherent_prof_stagiaire_instrument2_esa,
adherent_formation_prof.adherent_prof_stagiaire_instrument2_prof,
adherent_finance.statut_paiement
FROM adherent_formation_prof
INNER JOIN adherent_finance ON adherent_finance.identifiant = adherent_formation_prof.identifiant
WHERE (adherent_formation_prof.gsheet = '' OR adherent_formation_prof.gsheet IS NULL)
AND adherent_finance.statut_paiement = 'paye'
SELECT
adherent_eleve.date_maj,
adherent_eleve.saison,
adherent_eleve.identifiant,
adherent_eleve.association_suzuki,
adherent_eleve.eleve_nom,
adherent_eleve.eleve_prenom,
adherent_eleve.adherent_mail,
adherent_eleve.adherent_telephone_mobile,
adherent_eleve.eleve_datenaissance,
adherent_eleve.eleve_instrumentA,
adherent_eleve.eleve_instrumentA_cahier,
adherent_eleve.eleve_instrumentA_prof,
adherent_eleve.eleve_instrumentB,
adherent_eleve.eleve_instrumentB_cahier,
adherent_eleve.eleve_instrumentB_prof,
adherent_eleve.eleve_droitimage,
adherent_eleve.eleve_contactsup_nom,
adherent_eleve.eleve_contactsup_prenom,
adherent_eleve.eleve_contactsup_mail,
adherent_finance.statut_paiement
FROM adherent_eleve
INNER JOIN adherent_finance ON adherent_finance.identifiant = adherent_eleve.identifiant
WHERE (adherent_eleve.gsheet = '' OR adherent_eleve.gsheet IS NULL)
AND adherent_finance.statut_paiement = 'paye'
SELECT
adherent_finance.date_maj,
adherent_finance.saison,
adherent_finance.identifiant,
adherent_finance.association_suzuki,
adherent_finance.adherent_type,
adherent_finance.adherent_nom,
adherent_finance.adherent_prenom,
adherent_finance.adherent_telephone_mobile,
adherent_finance.adherent_mail,
adherent_finance.montant_adhesion,
adherent_finance.montant_don,
adherent_finance.montant_total,
adherent_finance.paiement_mode,
adherent_finance.date_paiement,
adherent_finance.stripe_retour,
adherent_finance.cheque_banque,
adherent_finance.cheque_numero,
adherent_finance.statut_paiement
FROM adherent_finance WHERE (adherent_finance.gsheet = '' OR adherent_finance.gsheet IS NULL)
AND adherent_finance.statut_paiement = 'paye'
SELECT
adherent.date_maj,
adherent.saison,
adherent.identifiant,
adherent.association_suzuki,
adherent.adherent_type,
adherent.adherent_nom,
adherent.adherent_prenom,
adherent.adherent_telephone_mobile,
adherent.adherent_mail,
adherent.adherent_adresse_rue,
adherent.adherent_adresse_complement,
adherent.adherent_adresse_codepostal,
adherent.adherent_adresse_ville,
adherent.adherent_adresse_pays,
adherent.adherent_telephone_fixe,
adherent.carte_envoi,
adherent_finance.statut_paiement,
adherent_finance.montant_adhesion,
adherent_finance.montant_don,
adherent_finance.montant_total,
adherent_finance.paiement_mode,
adherent_finance.date_paiement,
adherent_finance.stripe_retour,
adherent_finance.cheque_banque,
adherent_finance.cheque_numero,
adherent_professeur.adherent_prof_instrument1,
adherent_professeur.adherent_prof_instrument1_esa,
adherent_professeur.adherent_prof_instrument2,
adherent_professeur.adherent_prof_instrument2_esa,
adherent_professeur.adherent_prof_sece,
adherent_professeur.adherent_prof_ecole1,
adherent_professeur.adherent_prof_ecole1_mail,
adherent_professeur.adherent_prof_ecole1_web,
adherent_professeur.adherent_prof_ecole1_adresse,
adherent_professeur.adherent_prof_ecole1_cp,
adherent_professeur.adherent_prof_ecole1_ville,
adherent_professeur.adherent_prof_ecole2,
adherent_professeur.adherent_prof_ecole2_mail,
adherent_professeur.adherent_prof_ecole2_web,
adherent_professeur.adherent_prof_ecole2_adresse,
adherent_professeur.adherent_prof_ecole2_cp,
adherent_professeur.adherent_prof_ecole2_ville,
adherent_professeur.adherent_prof_ecole3,
adherent_professeur.adherent_prof_ecole3_mail,
adherent_professeur.adherent_prof_ecole3_web,
adherent_professeur.adherent_prof_ecole3_adresse,
adherent_professeur.adherent_prof_ecole3_cp,
adherent_professeur.adherent_prof_ecole3_ville,
adherent_formation_prof.adherent_prof_stagiaire_instrument1,
adherent_formation_prof.adherent_prof_stagiaire_instrument1_esa,
adherent_formation_prof.adherent_prof_stagiaire_instrument1_prof,
adherent_formation_prof.adherent_prof_stagiaire_instrument2,
adherent_formation_prof.adherent_prof_stagiaire_instrument2_esa,
adherent_formation_prof.adherent_prof_stagiaire_instrument2_prof,
adherent_eleve.eleve_nom,
adherent_eleve.eleve_prenom,
adherent_eleve.eleve_datenaissance,
adherent_eleve.eleve_instrumentA,
adherent_eleve.eleve_instrumentA_cahier,
adherent_eleve.eleve_instrumentA_prof,
adherent_eleve.eleve_instrumentB,
adherent_eleve.eleve_instrumentB_cahier,
adherent_eleve.eleve_instrumentB_prof,
adherent_eleve.eleve_droitimage,
adherent_eleve.eleve_contactsup_nom,
adherent_eleve.eleve_contactsup_prenom,
adherent_eleve.eleve_contactsup_mail
FROM adherent
-- Jointure avec adherent_finance
INNER JOIN adherent_finance ON adherent.identifiant = adherent_finance.identifiant
-- Jointure avec adherent_professeur
LEFT JOIN adherent_professeur ON adherent.identifiant = adherent_professeur.identifiant
-- Jointure avec adherent_formation_prof
LEFT JOIN adherent_formation_prof ON adherent.identifiant = adherent_formation_prof.identifiant
-- Jointure avec adherent_eleve
LEFT JOIN adherent_eleve ON adherent.identifiant = adherent_eleve.identifiant
WHERE (adherent.gsheet = '' OR adherent.gsheet IS NULL)
AND (adherent_finance.statut_paiement = 'paye' OR adherent_finance.statut_paiement = 'attente');