I have this query which sums the hours and gross earnings. I want to add TtlHours and TtlGrossEarnings to this same view but I am not sure how to do it. Seems like I should be able to do something like SUM(SUM(phptc.hours)) AS TtlHours being that is what I want as a result.
Here is the query that I am using before the totals.
SELECT DISTINCT
phptc.emp_id
, phptc.year
, phptc.pay_type
, pt.description
, SUM(phptc.hours) AS Hours
, SUM(phptc.gross) AS Gross
FROM
dbo.pay_history_paytype_cy phptc
INNER JOIN
dbo.pay_types pt
ON
phptc.pay_type = pt.pay_type
WHERE phptc.emp_id = 6111
GROUP BY
phptc.emp_id
, phptc.year
, phptc.pay_type
, pt.description
Thanks
tgfranz
Here is the query that I am using before the totals.
SELECT DISTINCT
phptc.emp_id
, phptc.year
, phptc.pay_type
, pt.description
, SUM(phptc.hours) AS Hours
, SUM(phptc.gross) AS Gross
FROM
dbo.pay_history_paytype_cy phptc
INNER JOIN
dbo.pay_types pt
ON
phptc.pay_type = pt.pay_type
WHERE phptc.emp_id = 6111
GROUP BY
phptc.emp_id
, phptc.year
, phptc.pay_type
, pt.description
Thanks
tgfranz