|
|
Archives of the TeradataForum
Message Posted: Thu, 01 Jul 2004 @ 16:45:52 GMT
Subj: | | Re: Aiii, INTERVALs! |
|
From: | | Maxwell, Donald |
I suggest you treat the HOUR TO MINUTE and SECONDS components seperately, eg.
SELECT (T2 - T1 HOUR TO MINUTE)
+ CAST ( (EXTRACT ( SECOND FROM (T2 - T1 HOUR TO SECOND) )
(DECIMAL(5,1))) AS INTERVAL SECOND )
Alternatively, you could compute the decimal number of seconds between your timestamps, round to 1 significant digit, then CAST back to
the HOUR TO SECOND interval datatype, eg.
SELECT ( EXTRACT ( SECOND FROM (T2 - T1 HOUR TO SECOND) / 3600 )
* 3600 (DECIMAL(9,1)) )
* CAST ( '00:00:01.0' AS INTERVAL HOUR(2) TO SECOND(1) )
Donald Maxwell
| |