我编写了以下SQL语句来提示用户输入日期范围,工作日和技能(这是一个用于呼叫中心的数据库住房呼叫数据)。一切正常,除了技能领域,只允许用户在其列表中包含一项技能,如果他们输入更多,则查询不返回任何数据。这可能是一个我不认识的简单修复,但我已经主演了一个多小时但看不到它:
SELECT AVG(Calls)*.55 AS ['Average Calls'], IntervalStatTime
FROM (SELECT CallsT.Day, Sum(CallsT.CallsOffered) AS Calls, CallsT.intervalStatTime, Weekday([Day]) AS WeekDayNum
FROM CallsT
WHERE (((CallsT.Day) Between CVDate([StartDate]) And CVDate([EndDate])) AND ((CallsT.skill) In ([skills])))
GROUP BY CallsT.Day, CallsT.intervalStatTime, Weekday([Day])
HAVING (((Weekday([Day]))=[Which Weekday])))
GROUP BY IntervalStatTime
UNION
SELECT AVG(Calls)*.45 AS ['Average Calls'], IntervalStatTime+timeserial(0,15,0)
FROM (SELECT CallsT.Day, Sum(CallsT.CallsOffered) AS Calls, CallsT.intervalStatTime, Weekday([Day]) AS WeekDayNum
FROM CallsT
WHERE (((CallsT.Day) Between CVDate([StartDate]) And CVDate([EndDate])) AND ((CallsT.skill) In ([skills])))
GROUP BY CallsT.Day, CallsT.intervalStatTime, Weekday([Day])
HAVING (((Weekday([Day]))=[Which Weekday])))
GROUP BY IntervalStatTime+timeserial(0,15,0)
ORDER BY IntervalStatTime;