Posts sum values from two different queries (sum totals of two queries)
Post
Cancel

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

1
2
3
4
5
6
7
8
-- 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

origin - https://www.pipiscrew.com/?p=19406 sum-values-from-two-different-queries-sum-totals-of-two-queries

This post is licensed under CC BY 4.0 by the author.
Contents

Trending Tags