Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
teamjai
Yak Posting Veteran
52 Posts |
Posted - 2013-05-14 : 05:12:39
|
SQL Query:select Name, OrgUnitFilterActive from [dbo].[cMat_Template_KDoc_C] as A LEFT OUTER JOIN [dbo].[cMat_Template_KDoc_Text_C] as B ON B.TemplateGUID = A.camosGUIDand A.OrgUnitFilterActive = 1 and B.TextLanguage = '1' JOIN [dbo].[cMat_Country_C] as C ON C.camosGUID = A.SalesOrgGIUD and C.camosGUID = 'E7E94D186E0952419FE1CE478EB95A6D' WHERE A.Deleted = 0OUTPUT:Name OrgUnitFilterActive------ ----------------------AAA 0BBB 0CCC 0DDD 0My Question is i check the condition "OrgUnitFilterActive = 1", but i got the output is "0"Why?Please help me Thanks |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2013-05-14 : 05:26:15
|
you're not doing the checking as a filter but you're only applying check while doing LEFT JOIN. So still records with OrgUnitFilterActive = 0 will come without matches from other end. What you're probably looking after is this?select Name, OrgUnitFilterActive from [dbo].[cMat_Template_KDoc_C] as A LEFT OUTER JOIN [dbo].[cMat_Template_KDoc_Text_C] as B ON B.TemplateGUID = A.camosGUIDand B.TextLanguage = '1' JOIN [dbo].[cMat_Country_C] as C ON C.camosGUID = A.SalesOrgGIUD and C.camosGUID = 'E7E94D186E0952419FE1CE478EB95A6D' WHERE A.Deleted = 0and A.OrgUnitFilterActive = 1 ------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/https://www.facebook.com/VmBlogs |
|
|
|
|
|