Archives of the TeradataForum
Message Posted: Wed, 03 Jul 2003 @ 01:31:03 GMT
Subj: | | Re: Selecting the min. non-null date |
|
From: | | Jake Johnson |
Try
select
case
when date 1 < date 2 and date 1 < date 3 and date 1 < date 4
then date 1
when date 2 < date 1 and date 2 < date 3 and date 2 < date 4
then date 1
when ....
This will work if your number of date columns doesn't change. You may want to try a pivot table so that if you have the number of rows X
the number of date columns and then take the max of them (while grouping by each record it). I will give it some more thought. This was
just my quick and dirty answer.
Regards,
Jake Johnson
|