|
|
Archives of the TeradataForum
Message Posted: Thu, 01 Nov 2001 @ 21:14:34 GMT
Subj: | | Re: User activity monitor |
|
From: | | Dieter N�th |
Why bothering with weird calculations when you can use INTERVALs???
select
logondate
,logontime
,logdate
,logdate
,(
cast(logdate as timestamp(0))
+ cast(substring(logtime from 1 for 8) as interval hour to second(0)))
-
(cast(logondate as timestamp(0))
+ cast(substring(logontime from 1 for 8) as interval hour to second(0))
) day(4) to second (0) as SessionDuration
from dbc.logonoff l
where event in ('logoff', 'forced off')
sample 10
so it's just weird CASTs
Dieter
| |