P
PMK
Object of the query outlined below is to sum cash values between saturday and
the following friday. Unfortunately the summation part of the query only
returns values from sunday to the following saturday therefore i am always
retrieving the wrong saturdays data.
Any help would be most appreciated.
PMK
SELECT Format(DatePart("ww",[Daterequired]),"00") & " " &
DateAdd("d",-Weekday([Daterequired])+0,[Daterequired]) & " and " &
DateAdd("d",-Weekday([Daterequired])+6,[Daterequired]) AS [Between],
Sum(Diary.Value) AS SumOfValue
FROM Diary
GROUP BY Format(DatePart("ww",[Daterequired]),"00") & " " &
DateAdd("d",-Weekday([Daterequired])+0,[Daterequired]) & " and " &
DateAdd("d",-Weekday([Daterequired])+6,[Daterequired]),
Format([DateRequired],"yyyy")
ORDER BY Format([DateRequired],"yyyy") DESC ,
Format(DatePart("ww",[Daterequired]),"00") & " " &
DateAdd("d",-Weekday([Daterequired])+0,[Daterequired]) & " and " &
DateAdd("d",-Weekday([Daterequired])+6,[Daterequired]) DESC;
the following friday. Unfortunately the summation part of the query only
returns values from sunday to the following saturday therefore i am always
retrieving the wrong saturdays data.
Any help would be most appreciated.
PMK
SELECT Format(DatePart("ww",[Daterequired]),"00") & " " &
DateAdd("d",-Weekday([Daterequired])+0,[Daterequired]) & " and " &
DateAdd("d",-Weekday([Daterequired])+6,[Daterequired]) AS [Between],
Sum(Diary.Value) AS SumOfValue
FROM Diary
GROUP BY Format(DatePart("ww",[Daterequired]),"00") & " " &
DateAdd("d",-Weekday([Daterequired])+0,[Daterequired]) & " and " &
DateAdd("d",-Weekday([Daterequired])+6,[Daterequired]),
Format([DateRequired],"yyyy")
ORDER BY Format([DateRequired],"yyyy") DESC ,
Format(DatePart("ww",[Daterequired]),"00") & " " &
DateAdd("d",-Weekday([Daterequired])+0,[Daterequired]) & " and " &
DateAdd("d",-Weekday([Daterequired])+6,[Daterequired]) DESC;