jeniferfleurant

mother children pcr

Aug 6th, 2019
3,453
0
Never
1
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MySQL 1.06 KB | None | 0 0
  1. SELECT
  2.     patient.patient_code AS infant_code,
  3.     COALESCE(date_of_birth, infant_dob) AS infant_dob,
  4.     CONCAT(testing_mereenfant.mother_city_code,
  5.             '/',
  6.             testing_mereenfant.mother_hospital_code,
  7.             '/',
  8.             testing_mereenfant.mother_code) AS mother_code_on_form,
  9.     x.patient_code AS mother_code_on_hiv,
  10.     date_blood_taken,
  11.     name AS pcr_result
  12. FROM
  13.     testing_specimen
  14.         LEFT JOIN
  15.     testing_mereenfant ON testing_mereenfant.id_patient = testing_specimen.id_patient
  16.         LEFT JOIN
  17.     (SELECT
  18.         patient_code
  19.     FROM
  20.         tracking_motherbasicinfo
  21.     LEFT JOIN patient ON patient.id = tracking_motherbasicinfo.id_patient) x ON x.patient_code = CONCAT(testing_mereenfant.mother_city_code,
  22.             '/',
  23.             testing_mereenfant.mother_hospital_code,
  24.             '/',
  25.             testing_mereenfant.mother_code)
  26.         LEFT JOIN
  27.     patient ON patient.id = testing_specimen.id_patient
  28.         LEFT JOIN
  29.     lookup_testing_lab_result ON lookup_testing_lab_result.id = pcr_result
Advertisement