jeniferfleurant icon

Positif under 5 with muac under 12.5

jeniferfleurant | PRO | 10/23/17 06:27:40 PM UTC | 0 ⭐ | 232 👁️ | Never ⏰ | []
MySQL |

840 B

|

None

|

0 👍

/

0 👎

select left(patient_code,8) as hospital, 
count(*) as total from
(select distinct patient_code from tracking_followup left join patient on patient.id=tracking_followup.id_patient
left join tracking_infant on patient.id=tracking_infant.id_patient
 where date between '2016-10-01' and '2017-09-30' and mid_arm_circumference>3 and mid_arm_circumference<=12.5
 and timestampdiff(month,dob,date)<60 and timestampdiff(month,dob,date)>=6
union
select distinct odk_child_visit.patient_code from openfn.odk_child_visit
left join patient on patient.patient_code=odk_child_visit.patient_code
left join tracking_infant on patient.id=id_patient
where 
date_of_visit between '2016-10-01' and '2017-09-30' and (muac>3) and muac<=12.5
and timestampdiff(month,dob,date_of_visit)<60 and timestampdiff(month,dob,date_of_visit)>=6
)a
group by left(patient_code,8)

Comments