B
brian
Okay, here's my situation...I have a table that looks as
follows:
Name 1stCall 2ndCall
Rep1 Date1 Date2
Rep2 Date1 Date2
Rep3 Date2 Date3
So this is tracking the dates that reps are making
outbound calls to a client. There is a date for the first
attempt, and a date for the second attempt.
I need to write a query that will give me total calls per
rep per day.
So far, I have the following SQL statement:
PARAMETERS [Start Date] DateTime, [End Date] DateTime;
SELECT DISTINCTROW [CMA User Contact].[CS_Rep], Count([CMA
User Contact].[1st_Call_Date]) AS CountOf1st_Call_Date,
Count([CMA User Contact].[2nd_Call_Date]) AS
CountOf2nd_Call_Date
FROM [CMA User Contact]
WHERE ((([CMA User Contact].[1st_Call_Date]) Between
[Start Date] And [End Date])) OR ((([CMA User Contact].
[2nd_Call_Date]) Between [Start Date] And [End Date]))
GROUP BY [CMA User Contact].[CS_Rep];
The issue is that it is returning counts for dates that
are outside the range entered. For example, if I enter a
single date as the start and stop for my range, it will
include calls that fell outside that range if they are in
the corresponding first/second call date field.
For example, if I enter 5/5/2004 as the start and end
date, it will return a count for a first call made
4/29/2004.
Can anyone think of a way to get the query to only return
records that fall within the given date range?
Thanks in advance
B
follows:
Name 1stCall 2ndCall
Rep1 Date1 Date2
Rep2 Date1 Date2
Rep3 Date2 Date3
So this is tracking the dates that reps are making
outbound calls to a client. There is a date for the first
attempt, and a date for the second attempt.
I need to write a query that will give me total calls per
rep per day.
So far, I have the following SQL statement:
PARAMETERS [Start Date] DateTime, [End Date] DateTime;
SELECT DISTINCTROW [CMA User Contact].[CS_Rep], Count([CMA
User Contact].[1st_Call_Date]) AS CountOf1st_Call_Date,
Count([CMA User Contact].[2nd_Call_Date]) AS
CountOf2nd_Call_Date
FROM [CMA User Contact]
WHERE ((([CMA User Contact].[1st_Call_Date]) Between
[Start Date] And [End Date])) OR ((([CMA User Contact].
[2nd_Call_Date]) Between [Start Date] And [End Date]))
GROUP BY [CMA User Contact].[CS_Rep];
The issue is that it is returning counts for dates that
are outside the range entered. For example, if I enter a
single date as the start and stop for my range, it will
include calls that fell outside that range if they are in
the corresponding first/second call date field.
For example, if I enter 5/5/2004 as the start and end
date, it will return a count for a first call made
4/29/2004.
Can anyone think of a way to get the query to only return
records that fall within the given date range?
Thanks in advance
B