Hello,
I need to count the total number of contacts occurring on weekdays (before 6 pm), weekday evenings (after 6), or Saturdays. Basically, every person must have 3 weekday calls, 1 evening and 1 Saturday. Below is a portion of the code I used successfully previously in Access, but now I am trying to use it with a SQL Server back end and I can't get it to work. I get an error when trying to calculate the weekday call portion: Sum(Abs(Weekday([ContactDate])<>7)) AS WkDay.
How do I count total phone calls by day of week and time with a SQL Server back end?
SELECT Main.PatID, Sum(Abs(Weekday([ContactDate])<>7)) AS WkDay
FROM Main INNER JOIN Contact ON Main.PatID = Contact.PatID
WHERE (((Contact.CONTACTTYPE)>199 And (Contact.CONTACTTYPE)<999) AND ((TimeValue([Contact].[contactdate]))<#12/30/1899 18:0:0#))
GROUP BY Main.PatID;