What do you mean by "6 thursdays in the date range", the number of thursdays in the calendar or the number of thursdays with data in your table?
#2 is easy using nested aggregates:
SELECT
AREA_NM_TURF,
CMTMT_DT (format 'eee') (char(3)) as DayofWeek,
avg(cnt) as CountbyDayofWeek
from
(
SELECT
AREA_NM_TURF,
CMTMT_DT,
Count (*) as cnt
FROM
...
group by 1,2
) as dt
group by 1,2
Dieter
↧