1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
|
Select
e.Ville,
(
Select Count(*)
from Entete as e1
where e1.Code = e.Code and e1.Type_med = 'I'
) as NbPatient_Interne,
(
Select Count(*)
From Entete as e2
inner join Analyse as a2 on e2.code = a2.Code
Where e2.Code = e.Code and e2.Type_med = 'I'
) as NbAnalyse_Interne,
(
Select Count(*)
from Entete as e3
where e3.Code = e.Code and e3.Type_med = 'E'
) as NbPatient_Externe,
(
Select Count(*)
From Entete as e4
inner join Analyse as a4 on e4.code = a4.Code
Where e4.Code = e.Code and e2.Type_med = 'E'
) as NbAnalyse_Externe
From Entete as e
Where Date_Saisie Between @PDateDebut and @PDateFin
Group By Ville |
Partager