|
|
Archives of the TeradataForum
Message Posted: Thu, 11 Aug 2005 @ 18:16:21 GMT
Subj: | | Finding the earliest combination of separate DATE and TIME fields |
|
From: | | Simon Bloomer |
Hi all
I was wondering what would be the easiest method of finding the earliest combination of separate DATE and TIME fields. Currently I am using
the following but surely there must be a more elegant way? Essentially what this is doing is subtracting some known date (in this case
2000/01/01) from the date in question and converting the result into seconds
SELECT
MIN ((startdate - date '2000-01-01') * 86400 +
substr(starttime,1,2)*3600 + substr(starttime,4,2)*60 +
substr(starttime,6,2))
FROM
IndividualActivity
Thanks
Simon
| |