売上げ総額に基づいて、10分位の上から9番目に入る各品目とそれぞれの売上げ総額を表示してみましょう。
SELECT itemID, sumPrice FROM (SELECT a1.itemID, SUM(price) FROM Sales a1 GROUP BY a1.itemID) AS T1(itemID, sumPrice) QUALIFY QUANTILE(10,sumPrice)=9;
売上げ総額に基づいて、10分位の上から9番目に入る各品目とそれぞれの売上げ総額を表示してみましょう。
SELECT itemID, sumPrice FROM (SELECT a1.itemID, SUM(price) FROM Sales a1 GROUP BY a1.itemID) AS T1(itemID, sumPrice) QUALIFY QUANTILE(10,sumPrice)=9;