試してみてください。
SELECT TOP 3
a1.year,
a1.quarter,
a1.team,
sum(a1.price) as Total
FROM
tbl_sales a1
inner JOIN
tbl_sales a2
ON a1.year = a2.year
and a1.quarter = a2.quarter
and a1.team = a2.team
and a1.price = a2.price
where
some restrictions here
GROUP BY
a1.year,
a1.quarter,
a1.team
ORDER BY
sum(a1.price) DESC
編集、次を試してみてください、あなたは正しい結果セットを取得することを確認するために追加の基準が必要になる場合がありますが、これは、私は、where句で指定された各四半期のトップ3を返す必要がありますあなたが自己を使用している理由がわからないので、私はそれを残したが、必要であれば、それはに戻って追加することができます参加:、
SELECT TOP 3
a1.year,
a1.quarter,
a1.team,
sum(a1.price) as Total
FROM
tbl_sales a1
WHERE
'some restrictions here'
AND a1.quarter = 1 --(or however quarters are identified)
AND a1.year = 2015 --(or however years are identified)
GROUP BY
a1.year,
a1.quarter,
a1.team
ORDER BY
sum(a1.price) DESC
UNION ALL
SELECT TOP 3
a2.year,
a2.quarter,
a2.team,
sum(a2.price) as Total
FROM
tbl_sales a2
WHERE
'some restrictions here'
AND a2.quarter = 2
AND a2.year = 2015
GROUP BY
a2.year,
a2.quarter,
a2.team
ORDER BY
sum(a2.price) DESC
UNION ALL
SELECT TOP 3
a3.year,
a3.quarter,
a3.team,
sum(a3.price) as Total
FROM
tbl_sales a3
WHERE
'some restrictions here'
AND a3.quarter = 3
AND a3.year = 2015
GROUP BY
a3.year,
a3.quarter,
a3.team
ORDER BY
sum(a3.price) DESC
UNION ALL
SELECT TOP 3
a1.year,
a1.quarter,
a1.team,
sum(a1.price) as Total
FROM
tbl_sales a4
WHERE
'some restrictions here'
AND a4.quarter = 4
AND a4.year = 2015
GROUP BY
a4.year,
a4.quarter,
a4.team
ORDER BY
sum(a4.price) DESC
あなたは、where句を除いて、テーブルの間に違いは基本的にありません見ることができるようにあなたはそれらの4つのテーブルの組合に限定されず、それは単なる例ですが、より多くの四半期をカバーする必要がある場合は、より多くの表を結合して結合する必要があることに留意してください。これは、時間の経過とともにテーブルをユニオンに追加し続ける必要があるので、非常に扱いにくくなる可能性があります。
最後に「ORDER BY Total DESC」を追加します。 AccessはSELECT TOP 3をサポートしていますか? – jarlh
https://support.office.com/en-us/article/ALL-DISTINCT-DISTINCTROW-TOP-Predicates-24f2a47d-a803-4c7c-8e81-756fe298ce57によれば、TOPは完全に有効です。 – ThisIsImpossible