Q:

Summing together values from the same table in different databases

I have a table on each database for a region of a company with the number of sales per month like so:
Region1.dbo. SalesPerMonth          Region2.dbo. SalesPerMonth

ID     Month     Sales             ID     Month     Sales
1      Jan          23             1      Jan          21
2      Feb          19             2      Feb          15
3      Jan          31             3      Jan          25
...    ...         ...             ...    ...         ...

I am looking to write a query to join these tables into one table that shows the sales for the entire company per month, so it has the total sales from all regions added together:
AllRegions

ID     Month     Sales
1      Jan          44
2      Feb          34 
3      Jan          56
...    ...         ...

I am however new to SQL and am not sure how to go about doing so.  Any help or advice on how to write the query would be greatly appreciated. 

A:

Union together the two tables, and then aggregate by ID and Month to generate the sum of sales. 
SELECT
    ID, Month, SUM(Sales) AS Sales
FROM
(
    SELECT ID, Month, Sales
    FROM Region1.dbo. SalesPerMonth
    UNION ALL
    SELECT ID, Month, Sales
    FROM Region2.dbo. SalesPerMonth
) t
GROUP BY
    ID, Month
ORDER BY
    ID;

Demo here:
Rextester

