User1042252450 posted
Hi all,
How to write the following UNION query in a single query
select distinct p.PatientId from Patient p
inner join PatientParticipant pp on pp.PatientId=p.PatientId
where pp.ClientID=245 and p.LastName like 's%' and pp.IsActive=1 and
p.PatientId in (select PatientId from PatientUser)
union all
select distinct p.PatientId from Patient p
inner join PatientParticipant pp on pp.PatientId=p.PatientId
where pp.ClientID=245 and p.LastName like 's%' and pp.IsActive=1 and
p.PatientId not in (select PatientId from PatientUser) and p.PatientId in (select PatientId from UserPatientClientFeature)
and p.DateOfBirth > '2002-10-09'
Thanks!