May 1, 2007 at 11:37 am
Hey guys, i created a TSQL script which produced the result set described below.
Pre-Status Current-Status
yes no
null yes
null null
question is how can i filter to prevent rows where both Pre-Status and Current-Status = null?
thx in advance
May 1, 2007 at 11:56 am
Add to you where condition
AND ([Pre-Status] IS NOT NULL AND [Current-Status] IS NOT NULL)
May 1, 2007 at 12:05 pm
didn't work
it's dropping other rows
here's an example of my where clause
where
Patient_Current_Pregnancy_details
.Gestational_Age_weeks >= '36'and
(
Patient_Current_Pregnancy_details.C13_Test_Result = 'Pos' or Patient_Current_Pregnancy_details.C13_Test_Result is null)
and
(Patient_Previous_C13_Test.Test_Result <> 'Neg' or Patient_Previous_C13_Test.Test_Result is null )
--and (Patient_Current_Pregnancy_details.C13_Test_Result is not null and Patient_Previous_C13_Test.Test_Result is not null)
May 1, 2007 at 12:22 pm
Sorry I meant OR not AND. Try this
WHERE
Patient_Current_Pregnancy_details.Gestational_Age_weeks >= '36'
and IsNull(Patient_Current_Pregnancy_details.C13_Test_Result,'Pos') = 'Pos'
and IsNull(Patient_Previous_C13_Test.Test_Result,'Neg') != 'Neg'
and (
Patient_Current_Pregnancy_details.C13_Test_Result is not null OR
Patient_Previous_C13_Test.Test_Result is not null
)
In the above either can be null but OR says both cannot be.
May 1, 2007 at 1:01 pm
thx man
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply