jeniferfleurant

mother code forme mere enfant

Sep 14th, 2018
318
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MySQL 0.93 KB | None | 0 0
  1. select mother.patient_code as mother_code,
  2.  
  3. child.patient_code as child_code,
  4. if(testing_mereenfant.id_patient is null, if((select id_patient from testing_mereenfant where id_patient=child_linked.id) is null, 'non','oui')
  5.  
  6. ,'oui') as 'forme mereenfant?'
  7.  
  8. from tracking_motherbasicinfo
  9. left join tracking_children on tracking_children.id_patient_mother=tracking_motherbasicinfo.id_patient
  10. left join testing_mereenfant on tracking_children.id_patient_child = testing_mereenfant.id_patient
  11. left join testing_specimen on testing_specimen.id_patient = tracking_children.id_patient_child
  12. left join patient mother on mother.id = tracking_motherbasicinfo.id_patient
  13. left join patient child on child.id = tracking_children.id_patient_child
  14. left join patient child_linked on child_linked.linked_to_id_patient = tracking_children.id_patient_child
  15. where id_patient_child!=0 and id_patient_child!=id_patient_mother and mother.patient_code is not null
Advertisement
Add Comment
Please, Sign In to add comment