I have a database that contains 3 tables, let's call them Test1, Test2, Test3
Test1
name |value | value2
A |0 | 0
B |1 | 1
Test2
name |value | value2
D |0 | 0
E |1 | 1
A |1 | 1
F |1 | 1
Test3
name |value | value2
B |1 | 0
C |1 | 1
F |0 | 1
Note that the tables have the same structure and the 'name' cells may repeat.
The result I want is to find unique 'name' cells across all the 3 tables, and get a total sum of corresponding value and value2 from all the 3 tables i.e.
Result
name |value | value2
A |1 | 1
B |2 | 1
C |1 | 1
D |0 | 0
E |1 | 1
F |1 | 2
I can't really figure out a query construction that would do it. I know it would be easier to merge the tables into one but unfortunately I can't do it. Any help/guidelines appreciated.