SSRS2005で使用するSQLでクエリを作成しています。
select t1.Category, t2.condition,'1' as hasCondition from t1
left outer join t2 on t1.ID = t2.ID
left outer join t3 on t2.cID = t3.cID
where t3.clientID = 6
union
select t1.Category, t2.condition, '0' as hasCondition from t1
left outer join t2 on t1.ID = t2.ID
そしてそれはデータを次のように返します:
Category Condition hasCondition
Behavioural Tourette's Syndrome 0
Communications Impaired Speech 0
Dexterity Osteoarthritus 0
Dexterity Osteoporosis 0
Dexterity Other Dexterity 0
Dexterity Rheumatoid Arthritus 0
Emotional Bipolar Disorder 0
Emotional Clinical Depression 0
Emotional Depression 0
Emotional Depression 1
Emotional Gulf War Syndrome 0
Emotional Gulf War Syndrome 1
次に、重複する行/結果から1つのレコードのみを選択します。たとえば、次のようになります。カテゴリ-感情的、状態-条件が「1」または「true」のうつ病
例を使って明確にしたいと思います。私を助けてください。
ありがとう。