问题描述
我正在尝试计算登录和注销日期时间字段的会话时间,但字段位于不同的记录和不同的列中。这可能是子查询吗?这里是非连续字段的示例,没有排序字段:
用户ID LogonhostDate LogoffhostDate
test1 228 9/4/2006 8:52 :下午38点
test1 229 9/4/2006 9:02:14 PM
test1 230 9/4/2006 9:06:59 PM
test1 231 9/4/2006 11:56:01 PM
test1 232 9/5/2006 12:01:56 AM
test1 233 9/5 / 2006 12:46:06
我不确定如何,或者甚至是必要的,将datetime字段放在同一条记录中。非常感谢任何帮助。
tdb
I am trying to calculate the session time for logon and logoff datetime fields, but the fields are in different records and different columns. Is this possible with a subquery? Here''s a sample of the non-sequential fields and no sequencing field:
UserIDLogonhostDateLogoffhostDate
test12289/4/2006 8:52:38 PM
test1229 9/4/2006 9:02:14 PM
test12309/4/2006 9:06:59 PM
test1231 9/4/2006 11:56:01 PM
test12329/5/2006 12:01:56 AM
test1233 9/5/2006 12:46:06 AM
I am not sure how to, or even if it;s necessary, to get the datetime fields in the same record. Any help is much appreciated.
tdb
推荐答案
这篇关于datediff()使用不同记录中的字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!