Senin, 09 Februari 2015

[MS_AccessPros] trying to limit encounters but want data to show if either column as a 1 in it

 

I have a query where there are two fields that could have tobacco interventions in it, so I want to see each encounter that has a 1 in the   dbo_wo_plan_detail_.tobacco_cessation_education     field or has a 1 in the  dbo_wo_tobacco_detailswithcess_.ecucation_completed  field. Person nbr is being pulled into the query since some of the patients are no longer active patients but for this query if they had an encounter in the year I needed them.  (it is in the [current smokers Encounters] query where the second pers number field is)

my query is pulling the data in so that It has two lines of data for the same encounter number

SELECT dbo_wo_plan_detail_.person_id, dbo_wo_plan_detail_.enc_id, dbo_wo_plan_detail_.tobacco_cessation_education, [Current Smokers Encounters].tobacco_yes, [Current Smokers Encounters].LastOfvisit_type_expanded, [Current Smokers Encounters].[Encounter Last in period].person_nbr, [Current Smokers Encounters].last_name, [Current Smokers Encounters].first_name, [Current Smokers Encounters].date_of_birth, [Current Smokers Encounters].dbo_person.person_nbr, dbo_wo_tobacco_detailswithcess_.ecucation_completed
FROM dbo_wo_tobacco_detailswithcess_ RIGHT JOIN ([Current Smokers Encounters] LEFT JOIN dbo_wo_plan_detail_ ON [Current Smokers Encounters].person_id = dbo_wo_plan_detail_.person_id) ON dbo_wo_tobacco_detailswithcess_.enc_id = dbo_wo_plan_detail_.enc_id
WHERE (((dbo_wo_plan_detail_.tobacco_cessation_education)>0)) OR (((dbo_wo_tobacco_detailswithcess_.ecucation_completed)>0));


thank you for your help
Patty

__._,_.___

Posted by: pattykf@cox.net
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (1)

.

__,_._,___

Tidak ada komentar:

Posting Komentar