creer requete a colonnes suplementaires
Bonjour
j'ai ces 2 requetes et 4 tables
adherents(id_adherents,.......)
acconage(id_acconage,#id_adherents,#id_shift.......)
transit(id_transit,#id_adherents,#id_shift,.......)
shift(id_adherents,.......)
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
| SELECT
ADHERENTS.lib_adherents AS lib_adherents,
SUM(FICHE_EMBAUCHE_ACCONAGE.docker_emb) AS la_somme_docker_emb,
shift.shift_lib AS shift_lib
FROM
shift,
FICHE_EMBAUCHE_ACCONAGE,
ADHERENTS
WHERE
FICHE_EMBAUCHE_ACCONAGE.IDshift = shift.IDshift
AND FICHE_EMBAUCHE_ACCONAGE.IDADHERENTS = ADHERENTS.IDADHERENTS
AND
(
shift.shift_lib = 'JOUR'
)
GROUP BY
ADHERENTS.lib_adherents,
shift.shift_lib |
-------------
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
| SELECT
ADHERENTS.lib_adherents AS lib_adherents,
SUM(FICHE_EMBAUCHE_ACCONAGE.docker_emb) AS la_somme_docker_emb,
shift.shift_lib AS shift_lib
FROM
shift,
FICHE_EMBAUCHE_ACCONAGE,
ADHERENTS
WHERE
FICHE_EMBAUCHE_ACCONAGE.IDshift = shift.IDshift
AND FICHE_EMBAUCHE_ACCONAGE.IDADHERENTS = ADHERENTS.IDADHERENTS
AND
(
shift.shift_lib = 'NUIT'
)
GROUP BY
ADHERENTS.lib_adherents,
shift.shift_lib |
Vous remarquerez que ces 2 requête ont une colonne en commun qui est la colonne lib_adherents
je voudrais a partir de ces 2 requêtes de 3 colonnes chacune créer une 3e requête de 4 colonnes
qui seront
lib_adherents------total_effectif_shift_Jour------ total_effectif_shift nuit----totaleffectif_shift
exemple
en utilisant la clause UNION ALL avec ces 2 requetes j'obtiens
societe_alpha 10
societe_alpha 20
je voudrais donc obtenir
societe_alpha 10 20 30
est ce possible?