| 120 | Using UNION to produce a list of S numbers and DOBs for participants who are either study specific recruits or have a specific primary or secondary diagnosis: |
| 121 | |
| 122 | mysql -h briccsdb -u auditor -p briccs -e " |
| 123 | SELECT barcode as 'Participant', birth_date as 'DOB' |
| 124 | FROM participant, questionnaire_participant, question_answer, category_answer |
| 125 | WHERE participant.id = questionnaire_participant.participant_id |
| 126 | AND question_answer.questionnaire_participant_id = questionnaire_participant.id |
| 127 | AND ( question_answer.question_name = 'epi_pridiag' OR question_answer.question_name = 'epi_secdiag' ) |
| 128 | AND category_answer.question_answer_id = question_answer.id |
| 129 | AND category_answer.category_name = 'Aortic_Stenosis' |
| 130 | UNION |
| 131 | SELECT barcode as 'Participant', birth_date as 'DOB' |
| 132 | FROM participant, questionnaire_participant, question_answer, category_answer |
| 133 | WHERE participant.id = questionnaire_participant.participant_id |
| 134 | AND question_answer.questionnaire_participant_id = questionnaire_participant.id |
| 135 | AND question_answer.question_name = 'epi_type' |
| 136 | AND category_answer.question_answer_id = question_answer.id |
| 137 | AND category_answer.category_name = 'Study_specific' |
| 138 | ; |
| 139 | " > mysql-output.txt |