Hello I am supposed to write a query that gets the total of drugs dispensed in a day and also the total of the week (ends sunday) for a given period.
I can get the first part of the query without problems.
SELECT [Filldate], Count([Filldate]) AS itemused From CNumber WHERE RegionId=1 And [CNumber].[Filldate] Between Format(#01/09/04 #,'mm/dd/yyyy')
And Format(#15/12/04#,'mm/dd/yyyy') GROUP BY [Filldate]);
The problem starts when I want to get the total for the weeks as well. I found out that I can use the weekday function to get the number of week in the given period but still no luck. Any help would be very much appreciated.for example with data like this
06/01 drugs used 4
08/01 drugs used 6
12/01 drugs used 4 the query should return
06/01 4
08/01 6
09/01 10
12/01 4 where 09/01 is sunday and therefore the end of the week and it sums the drugs dispensed from monday to saturady (sunday it is closed).
Thanks
Paolo
I can get the first part of the query without problems.
SELECT [Filldate], Count([Filldate]) AS itemused From CNumber WHERE RegionId=1 And [CNumber].[Filldate] Between Format(#01/09/04 #,'mm/dd/yyyy')
And Format(#15/12/04#,'mm/dd/yyyy') GROUP BY [Filldate]);
The problem starts when I want to get the total for the weeks as well. I found out that I can use the weekday function to get the number of week in the given period but still no luck. Any help would be very much appreciated.for example with data like this
06/01 drugs used 4
08/01 drugs used 6
12/01 drugs used 4 the query should return
06/01 4
08/01 6
09/01 10
12/01 4 where 09/01 is sunday and therefore the end of the week and it sums the drugs dispensed from monday to saturady (sunday it is closed).
Thanks
Paolo