Sum totals of two queries

Viewed 29099

I have two basic queries which I need to sum the totals of:

Select hours, sum(hours) FROM table WHERE name='xxx' and Description='Worked'
Select hours2, sum(hours2) FROM table WHERE name='xxx' and Description2='Worked'

I've tried UNION and it will get me the totals of each query but it will not combine them.

Table setup is:

  • ID
  • name
  • hours
  • description
  • hours2
  • description2

I need to correlate hours to description and hours2 to description2 which is why I have the two different queries. I need to sum the totals of hours and hours2.

2 Answers
Related