jeniferfleurant

ptme/hospital

Oct 6th, 2017
300
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MySQL 0.63 KB | None | 0 0
  1. select concat(city_code,'/',hospital_code) as hospital_code, count(*) as total from (select tracking_motherbasicinfo.id_patient from tracking_motherbasicinfo
  2. left join tracking_pregnancy on tracking_pregnancy.id_patient_mother=tracking_motherbasicinfo.id_patient
  3. where tracking_motherbasicinfo.created_at between'2016-10-01' and '2017-09-30' and is_ptme =1
  4. or  
  5. (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')))
  6. group by id_patient
  7. )a
  8. left join patient on patient.id=id_patient
  9. group by concat(city_code,'/',hospital_code)
Advertisement
Add Comment
Please, Sign In to add comment