我想得到第3栏和第3栏的总分数。列1和1中的每个县都有4个如下表所示2:
County1 | County2 | Player1_Score | Player2_Score
Norfolk | Hampshire | 5 | 7
Suffolk | Norfolk | 10 | 6
Hampshire | Suffolk | 16 | 12
Norfolk | Suffolk | 78 | 50
Hampshire | Norfolk | 4 | 8
Suffolk | Hampshire | 9 | 19
所以我希望看到的结果如下:
Norfolk | 97
Suffolk | 77
Hampshire | 32
任何人都可以帮忙吗?我尝试了一个SELECT/GROUP BY
查询但对SQL很新,无法获得我想要的结果。
非常感谢
答案 0 :(得分:3)
试试这个:
**This is ajax function**
$.ajax({
type : "Get",
url : url,
data:$("#client").serialize(),
dataType:'json',
success : function(response)
{
},
error : function(e)
{
alert('Error: ' + e);
}
});
答案 1 :(得分:0)
SEL CNTRY,SUM(SUM1) FROM
(
SEL COUNTRY1 AS CNTRY, SUM(player_score_1) AS SUM1 FROM VT1
GROUP BY 1
UNION
SEL COUNTRY2 AS CNTRY, SUM(player_score_2) FROM VT1
GROUP BY 1
) A
GROUP BY 1