I want to write a query to get difference of sum over two columns spread across two tables grouped by month.

Schema:

**TableA**

```
mass numeric,
weight numeric
sampleDt date

```

**TableB**

```
mass numeric,
weight numeric,
sampleDt date

```

**Sample Data for Table A**

```
100|200|2017-01-03
10 |20 |2017-01-05
200|400|2017-12-23

```

**Sample Data for Table B**

```
10   | 20   | 2017-01-20
10   | 20   | 2017-01-21
100  | 200  | 2017-12-12
2    | 4    | 2017-06-12

```

**Expected Output**

```
Month,Year |AMassTotal |AWeightTotal |BMassTotal |BWeightTotal |AMassTotal-BMassTotal

Jan,17 | 110 | 220 | 20 | 40 | 90
Jun,17 | 0   | 0   | 2  | 4  | -2
Dec,17 | 200 | 400 |100 |200 | 100

```