; avec le pivotdate comme (choisir le dateadd (sem., 17, « 20100101 ») comme DayInWkNumX)
, keyDates (FirstDayNextWeek, FirstDay9WeeksAgo, FirstDayNextWeekOneYearAgo, FirstDay9WeeksAgoOneYearAgo)
comme (
choisi
DATEADD (sem., datediff (sem., 0, DayInWkNumX) +1.0),
DATEADD (sem., datediff (sem., 0, DayInWkNumX) - 9.0),
dateadd (yy, - 1, DATEADD (sem., datediff (sem., 0, DayInWkNumX) +1.0)),
dateadd (yy, - 1, DATEADD (sem., datediff (sem., 0, DayInWkNumX) - 9.0))
du pivotdate
)
choisir Weeks10ToToday, Weeks10ToTodayOneYearAgo
de
(SOMME choisie (somevalue) COMME Weeks10ToToday des keyDates
intérieur joindre MyTable
sur le >= FirstDay9WeeksAgo de datefield et le datefield < FirstDayNextWeek="">= le FirstDay9WeeksAgoOneYearAgo et le datefield < FirstDayNextWeekOneYearAgo="">
|