製品コード10について、各四半期ごとに、昨年の同じ四半期との売上げの差異を表示してみましょう。
SELECT year_of_calendar, quarter_of_calendar, MDIFF(sumPrice, 4, year_of_calendar, quarter_of_calendar) FROM (SELECT a2.year_of_calendar, a2.quarter_of_calendar, SUM(a2.Price) AS sumPrice FROM Sales a1, SYS_CALENDAR.Calendar a2 WHERE a1.itemID=10 and a1.calendar_date=a2.calendar_date GROUP BY a2.year_of_calendar, a2.quarter_of_calendar) AS T1 ORDER BY year_of_calendar, quarter_of_year;