Results 1 to 4 of 4
  1. #1
    Join Date
    Dec 2009
    Posts
    5

    Unanswered: Determine Maximum Timestamp from a Set

    Hi guys,

    Probably most or some of you know the solution to this. As the title suggests, I have a set of Timestamps. I want to get the highest timestamp.
    Of course I can just use the case statement like:

    Code:
    CASE
    WHEN
      TIMESTAMP('2004-01-26 11:50:00.000000') > TIMESTAMP('2003-04-23 08:00:00.000000')
    THEN
       TIMESTAMP('2004-01-26 11:50:00.000000')
    WHEN...........
    THEN.....
    
    ELSE TIMESTAMP('2003-04-23 08:00:00.000000')
    end
    is there an easy way to do this? Or a way that I can make it using the MAX function:
    Code:
    MAX(TIMESTAMP('2004-01-26 11:50:00.000000'),TIMESTAMP('2003-04-23 08:00:00.000000'),.......,......)
    Thanks!

  2. #2
    Join Date
    Dec 2005
    Posts
    273
    Yes, you can use MAX(timestamp1,timestamp2....)

  3. #3
    Join Date
    Dec 2009
    Posts
    5
    Quote Originally Posted by umayer View Post
    Yes, you can use MAX(timestamp1,timestamp2....)
    I tried. But its telling me that there is no authorized routine with the same signature.

    Code:
    SELECT MAX(A.DATE_S, B.DATE_S, C.DATE_S) AS DATE_S FROM ......

  4. #4
    Join Date
    Feb 2008
    Location
    Japan
    Posts
    3,483
    Referencing manuals,
    MAX(timestamp1,timestamp2....) is supported on DB2 9.5 for LUW, DB2 Version 7 for z/OS and DB2 for iSeries.

Posting Permissions

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