0
我需要劃分兩列的總和在子查詢,通過第三場分組如下:總和分組的子查詢
Team | Score | MaxScorePossible
--------------------------------------------
A | 10 | 15
A | 12 | 20
B | 5 | 15
B | 7 | 20
我的代碼是這樣的:
SELECT (sumScore/sumMaxScore) as Percentage
FROM
(SELECT
sum(Score) as sumScore
FROM tableScore
GROUP BY Team) tbl1,
(SELECT
sum(MaxScorePossible) as sumMaxScore
FROM tableScore
GROUP BY Team) tbl2,
GROUP By Team
的輸出我希望是這樣的: A => 0.62,B => 0.34
問題很明顯,我分組子查詢和父查詢,但我不知道如何組並導致另一個類似的組合。
謝謝!非常感激! – DrBorrow