我正在使用SQL Server 2008 Management Studio从呼叫中心数据库获取数据,我有一个查询来从代理获取登录/注销时间,但每次LOGOUT值超出00:00(24) :00),结果我得到null。这是我的疑问:
SELECT
ROW_DATE AS [DATE], LOGID AS [ID],
LOGIN AS [Login], LOGOUT AS [Logout],
LOGOUTREASON as [Reason]
FROM db_xxxx.DBO.HAGLOG WITH (NOLOCK)
WHERE ACD = 2
AND (ROW_DATE BETWEEN '2015-05-05 00:00:00' AND '2015-05-05 23:59:59')
AND LOGID IN (98619)
示例:如果有人在06:00 PM登录并在00:30 AM注销,我将获得LOGOUT的NULL值。
提取数据(05/05 - 13/05):
DATE ID Login Logout Reason
2015-05-05 00:00:00.000 98619 1430848943 1430860539 0
2015-05-05 00:00:00.000 98619 1430860554 NULL NULL
2015-05-06 00:00:00.000 98619 1430935439 1430935856 8
2015-05-06 00:00:00.000 98619 1430935868 NULL NULL
2015-05-07 00:00:00.000 98619 1431022232 NULL NULL
2015-05-08 00:00:00.000 98619 1431108233 NULL NULL
2015-05-09 00:00:00.000 98619 1431172858 1431195952 0
2015-05-11 00:00:00.000 98619 1431367328 1431367616 8
2015-05-11 00:00:00.000 98619 1431367977 NULL NULL
2015-05-12 00:00:00.000 98619 1431453768 1431453982 8
2015-05-12 00:00:00.000 98619 1431453997 NULL NULL
2015-05-13 00:00:00.000 98619 1431540095 1431540631 8
2015-05-13 00:00:00.000 98619 1431540639 NULL NULL
我将登录/注销值除以86400,以便以小时格式获得正确的时间。