-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdate.sql
More file actions
12 lines (10 loc) · 764 Bytes
/
date.sql
File metadata and controls
12 lines (10 loc) · 764 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
select nname,agentid,concat(datepart(week,answeredtimeUTC),
datepart(YY,answeredtimeUTC)) AS WeekNo,convert(date,answeredtimeUTC) AS AnsweredDate,convert(time,cansweredtimeUTC) AS AnsweredTime ,(CASE
when '01:00'<convert(time,answeredtimeUTC) and convert(time,answeredtimeUTC)<'09:00' then 'Early Morning'
when '09:01:00'<convert(time,answeredtimeUTC) and convert(time,answeredtimeUTC)<'12:00' then 'Late Morning'
when '12:01:00'<convert(time,answeredtimeUTC) and convert(time,answeredtimeUTC)<'15:00' then 'Early Afternoon'
when '15:01:00'<convert(time,answeredtimeUTC) and convert(time,answeredtimeUTC)<'18:00' then 'Late Afternoon'
else 'Evening' end ) AS Zone
from CallHistoryView
where Sales=1
group by nname,agentid,answeredtimeUTC