テーブル構造:
country
season
points
現在のクエリ:
SELECT SUM(points) AS total, country
FROM table
WHERE season >= X
GROUP BY country
ORDER BY total desc
これにより、特定の国で収集された合計ポイントで並べ替えられた素敵なリストが得られます。しかし、ある国が別の国と結ばれている場合、指定された最新シーズンのポイントで並べ替えたいのですが、同じクエリ内で可能ですか? もしそうなら、どのように?(現時点でグループ化されていることを思い出してください)
行の例 デンマーク (国)、1 (季節)、10 (ポイント) デンマーク (国)、2 (季節)、5 (ポイント) スウェーデン (国)、1 (季節)、5 (ポイント) スウェーデン (国)、 2 (シーズン)、10 (ポイント)