Reputation: 115
Wasn't quite sure how to do this, but I'm sure it is pretty simple. For p.program_id I get several results such as OP, TEST, SA, INTAKE, etc and I would like to exclude intake, court, and test from those results. I would also like to do the same for patient_id to exclude our test users which I'm assuming would be the same thing. Figure it is some sort of exclude command to put in the where statement. I just don't know it. Thanks.
select
distinct p.patient_id,
p.date_discharged,
p.discharge_reason,
pa.lname+', '+pa.fname as 'Patient',
p.clinic_id,
p.service_id,
p.program_id,
p.protocol_id
from patient_assignment p
join patient pa
on p.patient_id = pa.patient_id
where (p.date_discharged between '2013-01-01 00:00:00.000'
and '2013-06-01 00:00:00.000')
Upvotes: 0
Views: 265