• There is an Inner join with a outer joined object, so the inner join on NULL may be your issue .

    Inner Join dbo.tblContracts C

    ON C.Contract_ID = TBL.TrackingID

    So, this may be avoided by altering the inner join to another left join

    or maybe better a nested inner join, by shifting the left joined on clause like this.

    SELECT OrgCode AS UnitState

    , OrgCode As State

    , IsNull(Count(*), 0) As [SLRP Approved]

    FROM tLookup_StateTable LKState

    Left Join dbo.tbl_Status_Of_ContractRequests_By_State TBL

    on LKState.OrgCode = TBL.UnitState

    LEFT Join dbo.tblContracts C ------ altered inner to left join (consequences)

    ON C.Contract_ID = TBL.TrackingID

    LEFT OUTER JOIN dbo.tLookup_Incentive Lkp

    ON C.IT_CODE = Lkp.IT_ID

    Where ( TBL.APPROVED > 0 )

    AND ( TBL.VERIFIED = 0 )

    AND ( TBL.[VERIFICATION FAILED] = 0 )

    AND ( TBL.[SYS VERIF - LOSS] = 0 )

    AND ( C.ContractStatus = 'A' )

    AND C.IT_Code = 'S'

    Group By OrgCode

    SELECT OrgCode AS UnitState

    , OrgCode As State

    , IsNull(Count(*), 0) As [SLRP Approved]

    FROM tLookup_StateTable LKState

    Left Join dbo.tbl_Status_Of_ContractRequests_By_State TBL

    Inner Join dbo.tblContracts C

    ON C.Contract_ID = TBL.TrackingID

    on LKState.OrgCode = TBL.UnitState --- nested inner join with left join

    LEFT OUTER JOIN dbo.tLookup_Incentive Lkp

    ON C.IT_CODE = Lkp.IT_ID

    Where ( TBL.APPROVED > 0 )

    AND ( TBL.VERIFIED = 0 )

    AND ( TBL.[VERIFICATION FAILED] = 0 )

    AND ( TBL.[SYS VERIF - LOSS] = 0 )

    AND ( C.ContractStatus = 'A' )

    AND C.IT_Code = 'S'

    Group By OrgCode

    Please test it and let us know your findings !

    Johan

    Learn to play, play to learn !

    Dont drive faster than your guardian angel can fly ...
    but keeping both feet on the ground wont get you anywhere :w00t:

    - How to post Performance Problems
    - How to post data/code to get the best help[/url]

    - How to prevent a sore throat after hours of presenting ppt

    press F1 for solution, press shift+F1 for urgent solution 😀

    Need a bit of Powershell? How about this

    Who am I ? Sometimes this is me but most of the time this is me