use greatest function sql to get a later date.
DBAsupport.com Forums - Powered by vBulletin
Results 1 to 2 of 2

Thread: use greatest function sql to get a later date.

  1. #1
    Join Date
    Apr 2006
    Posts
    1

    use greatest function sql to get a later date.

    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
    Last edited by jmodic; 04-19-2006 at 05:16 PM.

  2. #2
    Join Date
    Jun 2005
    Location
    London, UK
    Posts
    159
    Quote Originally Posted by tiffianypeck
    i dont know about the greatest function.
    i looked into it but my work did not compile.
    Well, GREATEST is the function you want. And now you know about it

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width