Hi,
I have this query:
SELECT [Org Level Dept],SUM([Direct Labor Hours]) AS [Direct Labor Hours] FROM ( SELECT pehCurHrs AS [Direct Labor Hours], pehOrgLvl1 AS [Org Level 1], pehOrgLvl2 AS [Org Level 2], Rtrim(pehOrgLvl2) + Right(pehOrgLvl1,3) AS [Org Level Dept] FROM EmpPers JOIN pearhist ph ON ph.pehEEID = eepEEID where pehPerControl > '201301011' AND pehearncode = '0001' ) X GROUP BY [Org Level Dept] ORDER BY [Org Level Dept]
Need to divide by the hours in this very similar query:
SELECT [Org Level Dept],SUM([Premium Labor Hours]) AS [Premium Labor Hours] FROM ( SELECT pehCurHrs AS [Premium Labor Hours], pehOrgLvl1 AS [Org Level 1], pehOrgLvl2 AS [Org Level 2], Rtrim(pehOrgLvl2) + Right(pehOrgLvl1,3) AS [Org Level Dept] FROM EmpPers JOIN pearhist ph ON ph.pehEEID = eepEEID where pehPerControl > '201301011' AND pehearncode = '0002' ) X GROUP BY [Org Level Dept] ORDER BY [Org Level Dept]
I need to divide the 'premium labor hours' by the 'direct labor hours' and have it broken out by 'org level dept'. So that I have the total precentage by org level dept (but only where there is a matching org level dept).
Been trying all kinds of different ways..can't get the right results.
qeqw