I have 2 tables.
The Result is
Issue is EnteredBy=23 is not displaying because I am using CT1.EnteredBy.How to display CT11.EnteredBy value instead of NULL
The Actual Query I am using is given below
With CT1 As( Select C1.EnteredBy,CodingTimeInMin =Sum(ROUND(CAST(C1.CODINGTIME AS FLOAT)/(CAST(60 AS FLOAT)),4)) from [dbo].[CodedDatas] C1 INNER JOIN (Select Document_Id,Max(LastModified) As LastModified from [DBO].[CODEDDATAS] Group By Document_Id) C2 on C1.Document_ID=C2.Document_ID And C1.Coded=1 And C1.Revision=0 --And C1.LastModified=C2.LastModified group by C1.EnteredBy ), CT11 As( Select C1.EnteredBy,ReviewedTimeInMin= Sum(ROUND(CAST(C1.QATime AS FLOAT)/(CAST(60 AS FLOAT)),4)) from [dbo].[CodedDatas] C1 INNER JOIN (Select Document_Id,Max(LastModified) As LastModified from [DBO].[CODEDDATAS] Group By Document_Id) C2 on C1.Document_ID=C2.Document_ID And C1.Coded=1 And C1.Revision=1 And C1.LastModified=C2.LastModified group by C1.EnteredBy ), CT2 As( Select CodingTimeInHR= ROUND(CT1.CodingTimeInMin/CAST(60 AS FLOAT), 4) , ReviewedTimeInHR= ROUND(CT11.ReviewedTimeInMin/CAST(60 AS FLOAT), 4) , EnteredBy=CT1.EnteredBy from CT1 full outer join CT11 on CT1.EnteredBy=CT11.EnteredBy ) select * from CT2;