Exception on Labkey SQL Parse - Can't edit query source | Anthony Corbett | 2013-09-25 14:50 |
Status: Closed | ||
I fixed this by putting the UNION query in a separate query, named "RSVPositiveTestsParticipants", and then used that in the sub-SELECT of the WHERE IN clause: SELECT demo.ParticipantId, contactInfo.infant_name, demo.hospital_enroll_site, demo.ParticipantId.Cohort, contactInfo.medRec_num, hsd.admission_date, hsd.discharge_date, demo.enroll_date, st.date as StudyTerminationDate FROM study.Demographics demo LEFT JOIN study."Contact Sheet" contactInfo ON contactInfo.ParticipantId = demo.ParticipantId LEFT JOIN study."Hospital Summary Dates" hsd ON hsd.ParticipantId = demo.ParticipantId LEFT JOIN study."Study Termination" st ON st.ParticipantId = demo.ParticipantId WHERE demo.ParticipantId.Cohort.Label = 'hospital' OR hsd.ParticipantId IN ( SELECT RSVPositiveTestsParticipants.ParticipantId FROM study.RSVPositiveTestsParticipants ) |
||