Can someone please help .
I have 2 SELECT queries A and Query B ,
the 2 queries were 1 before I separated them due to running slow taking 18minutes .
I have now split the 2 queries and A runs in 25 secs , B runs instantly . Both produce same number of records
Question
What will be the best way to add them together as I want the results in one lot please
,.Please let me know if I need to post the queries here
I have 2 SELECT queries A and Query B ,
the 2 queries were 1 before I separated them due to running slow taking 18minutes .
I have now split the 2 queries and A runs in 25 secs , B runs instantly . Both produce same number of records
Question
What will be the best way to add them together as I want the results in one lot please
Code:
Query A
SELECT
Key_Match.IDQ,
ProjectReturn_Detail.ProjectID,
Quarters.QtrName AS Quarter,
FROM
ProjectReturn_Detail
INNER JOIN Key_Match ON ProjectReturn_Detail.ProjReturnID = Key_Match.ProjDetID
INNER JOIN ProjectReturn_Leaders ON ProjectReturn_Detail.ProjReturnID = ProjectReturn_Leaders.ProjReturnID
INNER JOIN ProjectReturn_Finance ON ProjectReturn_Detail.ProjReturnID = ProjectReturn_Finance.ProjReturnID
LEFT JOIN RAG ON ProjectReturn_Detail.MPADCAID = RAG.DCAID
Query B
SELECT
Key_Match.IDQ,
ProjectReturn_Detail.ProjectID,
Quarters.QtrName AS Quarter,
Quarters.SnapshotDate AS [Quarter - Snapshot Date],
Datediff(day,[StartDateFor],[SnapshotDate])/365.25 AS [Duration - Spent - Forecast (Years)],
CASE
WHEN Datediff(day,[StartDateFor],[EndDateFor]) = 0 THEN NULL ELSE
Datediff(day,[StartDateFor],[SnapshotDate])/Datediff(day,[StartDateFor],[EndDateFor])
END
AS [Duration - Spent - Forecast (%)],
vwMilestoneAss_Next.[Milestone - Assurance - Next IPA Gate - Name]
FROM
ProjectReturn_Detail
INNER JOIN Key_Match ON ProjectReturn_Detail.ProjReturnID = Key_Match.ProjDetID
INNER JOIN [vwProject - Last QTR] ON ProjectReturn_Detail.ProjectID = [vwProject - Last QTR].ProjectID
INNER JOIN [vwProject - First QTR] ON ProjectReturn_Detail.ProjectID = [vwProject - First QTR].ProjectID
INNER JOIN Quarters ON ProjectReturn_Detail.QTRID = Quarters.QTR_ID
LEFT JOIN vwManMilestoneKDDStartEnd ON ProjectReturn_Detail.ProjReturnID = vwManMilestoneKDDStartEnd.ProjReturnID
LEFT JOIN vwMilestoneAss_Next ON ProjectReturn_Detail.ProjReturnID = vwMilestoneAss_Next.ProjReturnID;