From 48c5389a9c019f44b0a9b1031c61d529d395a869 Mon Sep 17 00:00:00 2001 From: Mumo Ngungu Date: Wed, 15 Nov 2023 14:02:15 +0300 Subject: [PATCH] fixing a bug --- Scripts/NDWH/C&T FACT TABLES/load_FactNCDs.sql | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Scripts/NDWH/C&T FACT TABLES/load_FactNCDs.sql b/Scripts/NDWH/C&T FACT TABLES/load_FactNCDs.sql index a7e3e8d9..0fce528d 100644 --- a/Scripts/NDWH/C&T FACT TABLES/load_FactNCDs.sql +++ b/Scripts/NDWH/C&T FACT TABLES/load_FactNCDs.sql @@ -141,8 +141,8 @@ select ncd_source_data."Thyroid disease", case when latest_diabetes_test.PatientPKHash is not null then 1 else 0 end as ScreenedDiabetes, case when latest_diabetes_test_controlled.PatientPKHash is not null then 1 else 0 end as IsDiabetesControlledAtLastTest, - case when visit.ScreenedBPLastVisit is not null then 1 else 0 end as ScreenedBPLastVisit, - case when visit.IsBPControlledAtLastVisit is not null then 1 else 0 end as IsBPControlledAtLastVisit + coalesce(visit.ScreenedBPLastVisit,0) as ScreenedBPLastVisit, + coalesce(visit.IsBPControlledAtLastVisit, 0) as IsBPControlledAtLastVisit into NDWH.dbo.FactNCD from ncd_source_data left join latest_diabetes_test on latest_diabetes_test.PatientPKHash = ncd_source_data.PatientPKHash