从两个不同的表中减去值

问题描述:

考虑表X:

A
-
1
2
3
3
6

考虑表Y:

A
-
0
4
2
1
9

如何编写查询以利用这两个表之间的差异来计算下表(例如表Z):

How do you write a query that takes the difference between these two tables, to compute the following table (say table Z):

A
-
1
-2
1
2
-3


不清楚您想要什么。

SELECT  (SELECT SUM(A) FROM X) - 
        (SELECT SUM(A) FROM Y)
        AS MyValue