I would like for each of the queries to have all of the selected fields shown horizontally in one table.For example,Commercial Created | Commercial Closed | Commercial UserId | Residential Created | Residential Closed | Residential UserId | Other Created | Other Closed | Other UserId.Here is what I have now and it is displaying the fields as I would like them to. In the code below, each Views is acting as an individual table and then joined together to make another table when the query is executed.WITH t1 AS (SELECT vSalesReportProcessDetail.[RequestId] ,vSalesReportProcessDetail.Process ,vSalesReportProcessDetail.Entered ,vSalesReportProcessDetail.Closed /*ROW_NUMBER() over (ORDER BY vSalesReportProcessDetail.[RequestId]) rn*/FROM[Sales].[dbo].[vSalesReportProcessDetail]WHERE Process = 'Commercial' ),t2 AS (SELECT vSalesReportProcessDetail.[RequestId] ,vSalesReportProcessDetail.Process ,vSalesReportProcessDetail.Entered ,vSalesReportProcessDetail.Closed /*ROW_NUMBER() over (ORDER BY vSalesReportProcessDetail.[RequestId]) rn*/FROM [Sales].[dbo].[vSalesReportProcessDetail]WHERE Process = 'Residential'),SELECT t1.[RequestId] ,t1.Process ,t1.Entered AS 'Commercial Entered' ,t1.Closed AS 'Commercial Closed' ,t2.Process ,t2.Entered AS 'Residential Entered' ,t2.Closed AS 'Residential Closed'
However, I need to add 3 more Views. When I try to add one more additional View from another table to this query, I get an error. I need to include the UserId which is in the SalesReportProcessUser table. WITH t1 AS (SELECT vSalesReportProcessDetail.[RequestId] ,vSalesReportProcessDetail.Process ,vSalesReportProcessDetail.Entered ,vSalesReportProcessDetail.Closed /*ROW_NUMBER() over (ORDER BY vSalesReportProcessDetail.[RequestId]) rn*/FROM[Sales].[dbo].[vSalesReportProcessDetail]WHERE Process = 'FrontDoor' ),t2 AS (SELECT vSalesReportProcessDetail.[RequestId] ,vSalesReportProcessDetail.Process ,vSalesReportProcessDetail.Entered ,vSalesReportProcessDetail.Closed /*ROW_NUMBER() over (ORDER BY vSalesReportProcessDetail.[RequestId]) rn*/FROM [Sales].[dbo].[vSalesReportProcessDetail]WHERE Process = 'Residential'),t3 AS (SELECTvSalesReportProcessUser.[RequestId],vSalesReportProcessUser.UserID/*ROW_NUMBER() over (ORDER BY vSalesReportProcessUser.[RequestId]) rn*/FROM[Sales].[dbo].[vSalesReportProcessUser])SELECT t1.[RequestId] ,t1.Process ,t1.Entered AS 'Commercial Entered' ,t1.Closed AS 'Commercial Closed' ,t2.Process ,t2.Entered AS 'Residential Entered' ,t2.Closed AS 'Residential Closed' ,t3.UserId
Thank you for your help in advance.Best regardsWestCote