売上げトップ100の品目について、各品目、それぞれの売上げ総額、それぞれの売上げ順位を表示してみましょう。
SELECT itemID, sumPrice, RANK(sumPrice) FROM (SELECT a1.itemID, SUM(a1.Price) FROM Sales a1 GROUP BY a1.itemID AS T1(itemID, sumPrice) QUALIFY RANK(sumPrice) <=100;
売上げトップ100の品目について、各品目、それぞれの売上げ総額、それぞれの売上げ順位を表示してみましょう。
SELECT itemID, sumPrice, RANK(sumPrice) FROM (SELECT a1.itemID, SUM(a1.Price) FROM Sales a1 GROUP BY a1.itemID AS T1(itemID, sumPrice) QUALIFY RANK(sumPrice) <=100;