>hi all,
>I have a customer who wants the average stock sold on a daily basis. what i need to find out is when he enters 2 dates, a from and a to, how do i calculate how many mondays, tuesdays.. there are in that range. its not enough to count the week numbers i need to find out that there were 3 mondays, 3 tuesdays, 4 wednesdays etc.
>~M
ldFrom = date()-7
ldTo = date()
create cursor cDates(dDate D)
for n=1 to ldTo-ldFrom
insert into cDates(dDate) value(ldFrom+n-1)
endfor
select cast(cdow(dDate) as C(10)) as dow, count(*) as cnt from cDates group by 1
Doru