Quantcast
Channel: Active questions tagged cte - Database Administrators Stack Exchange
Viewing all articles
Browse latest Browse all 207

How to show all the columns data in full outer join

$
0
0

I have 2 tables.

Table 1

Table 2

The Result is

Output

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;

Viewing all articles
Browse latest Browse all 207

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>