M
MichelleM via AccessMonster.com
I have a query that pulls data from several tables, if "CompleteAdherence.
Adherence" does not have any data for the parameters I enter, nothing comes
back. The Adherence field is averaged, so I cannot enter a "0", and since
these are numbers in calculations, I cannot change the field to text to enter
a "NA", otherwise it will not average in the report. Here is my query in SQL,
any insights or suggestions would be much appreciated! Thanks!
PARAMETERS [Start Date] DateTime, [End Date] DateTime;
SELECT tbldbo_vw_Agent_Stats_New.DATEDT, CompleteAdherence.Date, tblAgents.
[First Name], tblAgents.[Last Name], CompleteAdherence.Adherence,
tbldbo_vw_Agent_Stats_New.AnsweredACDCallCount, tbldbo_vw_Agent_Stats_New.
CallTalkTime, tbldbo_vw_Agent_Stats_New.InboundHoldTime,
tbldbo_vw_Agent_Stats_New.TrueFollowupTime, [CallTalkTime]+[InboundHoldTime]+
[TrueFollowupTime] AS InboundHandleTime, tbldbo_vw_Agent_Stats_New.
OutboundCount, tbldbo_vw_Agent_Stats_New.OutboundTime,
tbldbo_vw_Agent_Stats_New.OutboundHoldTime, tbldbo_vw_Agent_Stats_New.
OutboundCallFollowup, [OutboundTime]+[OutboundCallFollowup]+[OutboundHoldTime]
AS OutboundHandleTime, tbldbo_vw_Agent_Stats_New.AnsweredACDOtherMediaCount,
tbldbo_vw_Agent_Stats_New.OtherMediaHoldTime, tbldbo_vw_Agent_Stats_New.
OtherMediaTalkTime, tbldbo_vw_Agent_Stats_New.OtherMediaACWTime,
[OtherMediaACWTime]+[OtherMediaTalkTime]+[OtherMediaHoldTime] AS
OtherMediaHandleTime, tbldbo_vw_Agent_Stats_New.TransferTo3922,
tbldbo_vw_Agent_Stats_New.AwayStatusDuration, tbldbo_vw_Agent_Stats_New.
OtherStatusDuration, tblAgents.[Workgroup Leader], tblWGLs.[WGL ID],
tbldbo_vw_Agent_Stats_New.RecordingScoreCalls, tbldbo_vw_Agent_Stats_New.
RecordingCountCalls, tbldbo_vw_Agent_Stats_New.RecordingScoreEmails,
tbldbo_vw_Agent_Stats_New.RecordingCountEmails, tbldbo_vw_Agent_Stats_New.
RecordingCountMonthCalls, tbldbo_vw_Agent_Stats_New.RecordingScoreMonthCalls,
tbldbo_vw_Agent_Stats_New.RecordingCountMonthEmails,
tbldbo_vw_Agent_Stats_New.RecordingScoreMonthEmails, tblAgents.[InB Follow Up
Goal], tblAgents.[OB Follow Up Goal]
FROM (tblWGLs INNER JOIN (tblAgents INNER JOIN tbldbo_vw_Agent_Stats_New ON
tblAgents.[Login ID]=tbldbo_vw_Agent_Stats_New.CNAME) ON tblWGLs.[Workgroup
Leader]=tblAgents.[Workgroup Leader]) INNER JOIN CompleteAdherence ON
(tblAgents.[Login ID]=CompleteAdherence.[Login ID]) AND (CompleteAdherence.
Date=CDATE(tbldbo_vw_Agent_Stats_New.DATEDT))
WHERE (((CDate([DATEDT]))>=[Start Date] And (CDate([DATEDT]))<=[End Date])
AND ((CompleteAdherence.Date)>=[Start Date] And (CompleteAdherence.Date)<=
[End Date]))
GROUP BY tbldbo_vw_Agent_Stats_New.DATEDT, CompleteAdherence.Date, tblAgents.
[First Name], tblAgents.[Last Name], CompleteAdherence.Adherence,
tbldbo_vw_Agent_Stats_New.AnsweredACDCallCount, tbldbo_vw_Agent_Stats_New.
CallTalkTime, tbldbo_vw_Agent_Stats_New.InboundHoldTime,
tbldbo_vw_Agent_Stats_New.TrueFollowupTime, [CallTalkTime]+[InboundHoldTime]+
[TrueFollowupTime], tbldbo_vw_Agent_Stats_New.OutboundCount,
tbldbo_vw_Agent_Stats_New.OutboundTime, tbldbo_vw_Agent_Stats_New.
OutboundHoldTime, tbldbo_vw_Agent_Stats_New.OutboundCallFollowup,
[OutboundTime]+[OutboundCallFollowup]+[OutboundHoldTime],
tbldbo_vw_Agent_Stats_New.AnsweredACDOtherMediaCount,
tbldbo_vw_Agent_Stats_New.OtherMediaHoldTime, tbldbo_vw_Agent_Stats_New.
OtherMediaTalkTime, tbldbo_vw_Agent_Stats_New.OtherMediaACWTime,
[OtherMediaACWTime]+[OtherMediaTalkTime]+[OtherMediaHoldTime],
tbldbo_vw_Agent_Stats_New.TransferTo3922, tbldbo_vw_Agent_Stats_New.
AwayStatusDuration, tbldbo_vw_Agent_Stats_New.OtherStatusDuration, tblAgents.
[Workgroup Leader], tblWGLs.[WGL ID], tbldbo_vw_Agent_Stats_New.
RecordingScoreCalls, tbldbo_vw_Agent_Stats_New.RecordingCountCalls,
tbldbo_vw_Agent_Stats_New.RecordingScoreEmails, tbldbo_vw_Agent_Stats_New.
RecordingCountEmails, tbldbo_vw_Agent_Stats_New.RecordingCountMonthCalls,
tbldbo_vw_Agent_Stats_New.RecordingScoreMonthCalls, tbldbo_vw_Agent_Stats_New.
RecordingCountMonthEmails, tbldbo_vw_Agent_Stats_New.
RecordingScoreMonthEmails, tblAgents.[InB Follow Up Goal], tblAgents.[OB
Follow Up Goal], tbldbo_vw_Agent_Stats_New.CNAME, tblAgents.[Login ID]
HAVING (((tblWGLs.[WGL ID])=[Enter WGL ID]));
Adherence" does not have any data for the parameters I enter, nothing comes
back. The Adherence field is averaged, so I cannot enter a "0", and since
these are numbers in calculations, I cannot change the field to text to enter
a "NA", otherwise it will not average in the report. Here is my query in SQL,
any insights or suggestions would be much appreciated! Thanks!
PARAMETERS [Start Date] DateTime, [End Date] DateTime;
SELECT tbldbo_vw_Agent_Stats_New.DATEDT, CompleteAdherence.Date, tblAgents.
[First Name], tblAgents.[Last Name], CompleteAdherence.Adherence,
tbldbo_vw_Agent_Stats_New.AnsweredACDCallCount, tbldbo_vw_Agent_Stats_New.
CallTalkTime, tbldbo_vw_Agent_Stats_New.InboundHoldTime,
tbldbo_vw_Agent_Stats_New.TrueFollowupTime, [CallTalkTime]+[InboundHoldTime]+
[TrueFollowupTime] AS InboundHandleTime, tbldbo_vw_Agent_Stats_New.
OutboundCount, tbldbo_vw_Agent_Stats_New.OutboundTime,
tbldbo_vw_Agent_Stats_New.OutboundHoldTime, tbldbo_vw_Agent_Stats_New.
OutboundCallFollowup, [OutboundTime]+[OutboundCallFollowup]+[OutboundHoldTime]
AS OutboundHandleTime, tbldbo_vw_Agent_Stats_New.AnsweredACDOtherMediaCount,
tbldbo_vw_Agent_Stats_New.OtherMediaHoldTime, tbldbo_vw_Agent_Stats_New.
OtherMediaTalkTime, tbldbo_vw_Agent_Stats_New.OtherMediaACWTime,
[OtherMediaACWTime]+[OtherMediaTalkTime]+[OtherMediaHoldTime] AS
OtherMediaHandleTime, tbldbo_vw_Agent_Stats_New.TransferTo3922,
tbldbo_vw_Agent_Stats_New.AwayStatusDuration, tbldbo_vw_Agent_Stats_New.
OtherStatusDuration, tblAgents.[Workgroup Leader], tblWGLs.[WGL ID],
tbldbo_vw_Agent_Stats_New.RecordingScoreCalls, tbldbo_vw_Agent_Stats_New.
RecordingCountCalls, tbldbo_vw_Agent_Stats_New.RecordingScoreEmails,
tbldbo_vw_Agent_Stats_New.RecordingCountEmails, tbldbo_vw_Agent_Stats_New.
RecordingCountMonthCalls, tbldbo_vw_Agent_Stats_New.RecordingScoreMonthCalls,
tbldbo_vw_Agent_Stats_New.RecordingCountMonthEmails,
tbldbo_vw_Agent_Stats_New.RecordingScoreMonthEmails, tblAgents.[InB Follow Up
Goal], tblAgents.[OB Follow Up Goal]
FROM (tblWGLs INNER JOIN (tblAgents INNER JOIN tbldbo_vw_Agent_Stats_New ON
tblAgents.[Login ID]=tbldbo_vw_Agent_Stats_New.CNAME) ON tblWGLs.[Workgroup
Leader]=tblAgents.[Workgroup Leader]) INNER JOIN CompleteAdherence ON
(tblAgents.[Login ID]=CompleteAdherence.[Login ID]) AND (CompleteAdherence.
Date=CDATE(tbldbo_vw_Agent_Stats_New.DATEDT))
WHERE (((CDate([DATEDT]))>=[Start Date] And (CDate([DATEDT]))<=[End Date])
AND ((CompleteAdherence.Date)>=[Start Date] And (CompleteAdherence.Date)<=
[End Date]))
GROUP BY tbldbo_vw_Agent_Stats_New.DATEDT, CompleteAdherence.Date, tblAgents.
[First Name], tblAgents.[Last Name], CompleteAdherence.Adherence,
tbldbo_vw_Agent_Stats_New.AnsweredACDCallCount, tbldbo_vw_Agent_Stats_New.
CallTalkTime, tbldbo_vw_Agent_Stats_New.InboundHoldTime,
tbldbo_vw_Agent_Stats_New.TrueFollowupTime, [CallTalkTime]+[InboundHoldTime]+
[TrueFollowupTime], tbldbo_vw_Agent_Stats_New.OutboundCount,
tbldbo_vw_Agent_Stats_New.OutboundTime, tbldbo_vw_Agent_Stats_New.
OutboundHoldTime, tbldbo_vw_Agent_Stats_New.OutboundCallFollowup,
[OutboundTime]+[OutboundCallFollowup]+[OutboundHoldTime],
tbldbo_vw_Agent_Stats_New.AnsweredACDOtherMediaCount,
tbldbo_vw_Agent_Stats_New.OtherMediaHoldTime, tbldbo_vw_Agent_Stats_New.
OtherMediaTalkTime, tbldbo_vw_Agent_Stats_New.OtherMediaACWTime,
[OtherMediaACWTime]+[OtherMediaTalkTime]+[OtherMediaHoldTime],
tbldbo_vw_Agent_Stats_New.TransferTo3922, tbldbo_vw_Agent_Stats_New.
AwayStatusDuration, tbldbo_vw_Agent_Stats_New.OtherStatusDuration, tblAgents.
[Workgroup Leader], tblWGLs.[WGL ID], tbldbo_vw_Agent_Stats_New.
RecordingScoreCalls, tbldbo_vw_Agent_Stats_New.RecordingCountCalls,
tbldbo_vw_Agent_Stats_New.RecordingScoreEmails, tbldbo_vw_Agent_Stats_New.
RecordingCountEmails, tbldbo_vw_Agent_Stats_New.RecordingCountMonthCalls,
tbldbo_vw_Agent_Stats_New.RecordingScoreMonthCalls, tbldbo_vw_Agent_Stats_New.
RecordingCountMonthEmails, tbldbo_vw_Agent_Stats_New.
RecordingScoreMonthEmails, tblAgents.[InB Follow Up Goal], tblAgents.[OB
Follow Up Goal], tbldbo_vw_Agent_Stats_New.CNAME, tblAgents.[Login ID]
HAVING (((tblWGLs.[WGL ID])=[Enter WGL ID]));