I am Using SQL2005..
My query so far is this:
Select
Customer.Name
, Service.service
, Customer.IsCurrentPatient
from customer
Inner Join service on
Customer.person_id= service.person_id
Where Customer.IsCurrentPatient=’Y’
This Returns:
Sally Jones Meds
Sally Jones Office Visit
Tom Brown Meds
John Doe Office Visit
John Doe Therapy
What I want to see in my final results is any patient who has ONLY Meds (or) ONLY Meds AND Office Visit.
So in this example, I want to return Sally Jones because she has Meds and Office Visit; Tom Brown because he has only Meds; but NOT John Doe because he has Office Visit but no Meds.
Can anyone help me finish this query?
Thanks for any help with this.
My query so far is this:
Select
Customer.Name
, Service.service
, Customer.IsCurrentPatient
from customer
Inner Join service on
Customer.person_id= service.person_id
Where Customer.IsCurrentPatient=’Y’
This Returns:
Sally Jones Meds
Sally Jones Office Visit
Tom Brown Meds
John Doe Office Visit
John Doe Therapy
What I want to see in my final results is any patient who has ONLY Meds (or) ONLY Meds AND Office Visit.
So in this example, I want to return Sally Jones because she has Meds and Office Visit; Tom Brown because he has only Meds; but NOT John Doe because he has Office Visit but no Meds.
Can anyone help me finish this query?
Thanks for any help with this.