| 58 | SELECT |
| 59 | p.id AS ParticipantID |
| 60 | , p.barcode AS StudyID |
| 61 | , p.first_name |
| 62 | , p.last_name |
| 63 | , p.birth_date |
| 64 | , p.gender |
| 65 | , p.enrollment_id AS UhlSystemNumber |
| 66 | , consent_q1.value AS consent_q1 |
| 67 | FROM participant p |
| 68 | LEFT JOIN ( |
| 69 | SELECT |
| 70 | qp.participant_id |
| 71 | , ca.category_name AS value |
| 72 | FROM question_answer qa |
| 73 | JOIN category_answer ca ON ca.question_answer_id = qa.id |
| 74 | JOIN questionnaire_participant qp ON qp.id = qa.questionnaire_participant_id |
| 75 | AND qp.questionnaire_name = 'ManualConsentQuestionnaire' |
| 76 | WHERE qa.question_name = 'consent_q1' |
| 77 | ) consent_q1 ON consent_q1.participant_id = p.id |
| 78 | ; |
| 79 | |