Bonjour,
Je dispose de plusieurs tables t1, t2, t3 qui contiennent une colonne avec une définition identique, le champ nom en varchar(100)
Je souhaite regrouper ce champ de chacune des tables dans unn champ unique
par exemple
t1 contient sous son champ "nom" : "marc", "simone"
t2 contient sous son champ "nom" : "pierre"
t3 contient sous on champ "nom" : "sylvie", "corinne"
le résultat serait sous un champ "nom" : marc, simone, pierre, sylvie, corinne
J'ai bien tenté un union mais j'ai quelques jointures en plus à gérer et j'ai du mal
Toutes les lignes de tbltest se dupliquent !!!!
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14 (select t.id, a.nom, t.nom, c.nom, t_1.nom from tbltest t left join t1 t_1 ON t_1.id_test=t.id left join tblaudio a ON t_1.id_audio=a.id left join tbladherent c ON t_1.id_createur=c.id) union (select t.id, a.nom, t.nom, c.nom, t_2.nom from tbltest t left join t2 t_2 ON t_2.id_test=t.id left join tblaudio a ON t_2.id_audio=a.id left join tbladherent c ON t_2.id_createur=c.id) union (select t.id, a.nom, t.nom, c.nom, t_3.nom from tbltest t left join t3 t_3 ON t_3.id_test=t.id left join tblaudio a ON t_3.id_audio=a.id left join tbladherent c ON t_3.id_createur=c.id)
Pouvez vous me conseiller merci.
Partager