vsprogrammer
Programmer
Hi all!
I am trying to create a query for that will allow me to pull the following info:
Triglycerides, Cholesterol LEVEL, Hours Fasting, Total: HDL Cholesterol Ratio, HDL Cholesterol, and LDL Calculated.
This is what I have so far:
select distinct
rip.name 'Policy Name',
rci.itemname 'Item Name'
from
cv3relevantinfopolicy rip
join cv3relevantinfopolicydtl ripd on rip.guid = ripd.relevantinfopolicyguid
join cv3resultcatalogitem rci on rci.guid = ripd.relevantitemguid
where
rci.itemname
IN
(
'Triglycerides',
'Cholesterol LEVEL',
'Hours Fasting',
'Total: HDL Cholesterol Ratio',
'HDL Cholesterol',
'LDL Calculated'
)
order by
rip.name
This query however shows me policies that just have 'Triglycerides' or just has hours fasting, I need to see the policy that contains all the items (no more no less). I have tried to use "and" and "or" I have tried right joins and left joins but nothing seems to be working. I am using SQL 2005. I hope that this makes sense and that someone can point me in the right direction?
Thanks a bunch!
VSProgammer
I am trying to create a query for that will allow me to pull the following info:
Triglycerides, Cholesterol LEVEL, Hours Fasting, Total: HDL Cholesterol Ratio, HDL Cholesterol, and LDL Calculated.
This is what I have so far:
select distinct
rip.name 'Policy Name',
rci.itemname 'Item Name'
from
cv3relevantinfopolicy rip
join cv3relevantinfopolicydtl ripd on rip.guid = ripd.relevantinfopolicyguid
join cv3resultcatalogitem rci on rci.guid = ripd.relevantitemguid
where
rci.itemname
IN
(
'Triglycerides',
'Cholesterol LEVEL',
'Hours Fasting',
'Total: HDL Cholesterol Ratio',
'HDL Cholesterol',
'LDL Calculated'
)
order by
rip.name
This query however shows me policies that just have 'Triglycerides' or just has hours fasting, I need to see the policy that contains all the items (no more no less). I have tried to use "and" and "or" I have tried right joins and left joins but nothing seems to be working. I am using SQL 2005. I hope that this makes sense and that someone can point me in the right direction?
Thanks a bunch!
VSProgammer