How to add results of two select commands in same query-Lemborco

By using union all clause two query can be combine into one and get one result.


I currently have two select commands as per below. What I would like to do is to add the results together in the SQL query rather than the variables in code.

SELECT  SUM(totalHours) totalHours
            select sum(hours) totalHours from resource
            UNION ALL
            select sum(hours) totalHours from projects-time
        ) s




Similar Posts