I'm trying to take the total from three queries qryBOM
, qryLabour
and qryLaser
and have them listed on one line.
I've create a qryTotals
Filter and here's my code:
SELECT
Sum(tempTotalLabour) AS TotalLabour,
Sum(tempTotalCost) AS TotalCost,
Sum(tempTotalLaser) AS TotalLaser,
[TotalLabour] + [TotalCost] + [TotalLaser] AS ProductCost
FROM
(
SELECT
Sum([qryLabour].[Labour Mins]) AS tempTotalLabour,
Sum([qryLabour].[$ Cost]) AS tempTotalCost,
Sum([qryLabour].[Laser Mins]) AS tempTotalLabour
FROM
qryLabour
union all
SELECT
Sum([qryBOM].[Labour Mins]) AS tempTotalLabour,
Sum([qryBOM].[$ Cost]) AS tempTotalCost,
Sum([qryBOM].[Laser Mins]) AS tempTotaMaterial
FROM
qryBOM
union all
SELECT
Sum([qryLaser].[Labour Mins]) AS tempTotalLabour,
Sum([qryLaser].[$ Cost]) AS tempTotalCost,
Sum([qryLaser].[Laser Mins]) AS tempTotalLaser
FROM
qryLaser
) AS TotalTable;
But I'm getting the error Duplicate Output Alias - 'tempTotalLabour'
. Please can someone help me with where I'm going wrong so I can fix this and learn for future.
Cheers Chris