1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
| SELECT M.Par_ID, Parentee,Nom, Prénom
FROM
(SELECT distinct E.par_id FROM enfants E
WHERE E.enf_prenom = 'mariam'
AND enf_datenais BETWEEN (Date1 AND Date2)) F
inner join
(Select M.Par_ID, 'Mère' parentée,M.Par_NomMere as Nom, M.Par_PrenomMere Prénom
from parents M
union
Select P.Par_ID, 'Père' parentée,P.Par_NomPere as Nom, P.Par_PrenomPere as Prénom
from parents P
union
Select Par_ID, 'enfant' as parentée, null as Nom, Enf_Prenom as Prénom from Enfants
) as L
on P.par_id = L.par_id |
Partager