Código SQL:
Ver originalCREATE TABLE #temp
(
value1 VARCHAR(10),
value2 VARCHAR(10),
value3 INT
)
CREATE TABLE #temp2
(
value1 VARCHAR(10),
value2 VARCHAR(10),
value3 INT
)
INSERT INTO #temp VALUES ('123','A',3)
INSERT INTO #temp VALUES ('123','C',4)
INSERT INTO #temp2 VALUES ('1234','A',2)
INSERT INTO #temp2 VALUES ('2345','B',3)
SELECT SUM(value3) FROM(
SELECT * FROM #temp
UNION
SELECT * FROM #temp2
) t1 WHERE value2='A'
saludos!