sum values from two different queries (sum totals of two queries)

Costas

Administrator
Staff member
JavaScript:
-- https://stackoverflow.com/a/6685597

SELECT SUM(hr) FROM
(
  Select sum(hours) as hr FROM table WHERE name='xxx' and Description='Worked'
  UNION ALL
  Select sum(hours2) as hr FROM table WHERE name='xxx' and Description2='Worked'
)a
 
Top