select max date from a group of columns of type date
601630Oct 8 2007 — edited Apr 3 2010hi ,
my requirement is i have 5 columns
ID, date1,date2,date3,date4.
first column is integer type and is primary key and remaining all columns are type DATE
the values in the table are for example:
ID date1 date2 date3 date4
100 8/19/2007 4:29:44 PM 8/18/2007 3:50:34 PM 8/16/2007 3:20:55 PM 8/20/2007 5:19:24 PM
101 8/21/2007 5:29:44 PM 8/19/2007 4:20:34 PM 8/19/2007 4:29:44 PM 8/18/2007 2:50:45 PM
the output required is
ID closeddate
100 8/20/2007 5:19:24 PM
101 8/21/2007 5:29:44 PM
i want the max of all dates in all date columns in one single column for each row
the query which i tried is
select ID,max(closed_date)
from t1,TABLE(Date(date1,date2,date3,date4)) closeddate
but its not working
can any body help me out in solving this
thanks in advance