jeniferfleurant icon

ptme/hospital

jeniferfleurant | PRO | 10/06/17 08:10:38 PM UTC | 0 ⭐ | 273 šŸ‘ļø | Never ā° | []
MySQL |

630 B

|

None

|

0 šŸ‘

/

0 šŸ‘Ž

select concat(city_code,'/',hospital_code) as hospital_code, count(*) as total from (select tracking_motherbasicinfo.id_patient from tracking_motherbasicinfo 
left join tracking_pregnancy on tracking_pregnancy.id_patient_mother=tracking_motherbasicinfo.id_patient
where tracking_motherbasicinfo.created_at between'2016-10-01' and '2017-09-30' and is_ptme =1 
or Ā 
(tracking_motherbasicinfo.created_at >= '2016-10-01' and ((dpa between'2016-10-01' and '2017-09-30') or (actual_delivery_date between'2016-10-01' and '2017-09-30')))
group by id_patient
)a
left join patient on patient.id=id_patient
group by concat(city_code,'/',hospital_code)

Comments