Click to See Complete Forum and Search --> : use greatest function sql to get a later date.


tiffianypeck
04-19-2006, 05:19 PM
hello,
i have about 4 date fields in my table.
col1
col2
col3
col4

i need to get the latest date of the four fields.
as new_col
for example.

select column_id

then find the later of the four columns with the date field values.
so for id 11 it could be col2
id2 it is column 4 and so on.

how ca i do this in oracle.

i dont know about the greatest function.
i looked into it but my work did not compile.
thanks in adv

WilliamR
04-19-2006, 06:54 PM
i dont know about the greatest function.
i looked into it but my work did not compile.
Well, GREATEST (http://download-uk.oracle.com/docs/cd/B19306_01/server.102/b14200/functions060.htm) is the function you want. And now you know about it ;)