How to summarize Bridge results? I am trying to summarize Bridge results for each pair (north/south pair and east/west pair).

Match points for pair north/south is MPNS, for pair east/west is MPEW. Is there a way to summarize all match points for pair from MPNS and MPEW given the following data?


Boards results for sample are:
board ns ew score MPNS MPEW
1     1  2  110     0   4
1     3  4  120     2   2
1     5  6  150     4   0
2     1  4  150     4   0
2     2  6  120     2   2
2     3  5  100     0   4
3     1  6  100     1   3
3     4  2  150     4   0
3     5  3  100     1   3

and how get result for pairs:

pair sum
  1     5
  2     6
  3     5
  4     6
  5     9
  6     5
Based on the comments, this is one possible solution:


select a.NS, Sum(a.MPNS) from
(select ns, MPNS from match_points
union all
select ew, MPEW from match_points) a
group by a.ns


which returns the required results.

SQLFiddle version of the data here - http://www.sqlfiddle.com/#!2/7e473/11