Results 1 to 2 of 2
  1. #1
    Join Date
    Dec 2011

    Unanswered: Penultimate date from a list


    I am very new to informix and am looking for some help

    I need to know how to find the right syntex to find the penultimate date from a list

    I can find the maximum date: Select MAX(datetime) maximum_date

    I am thinking that i need to use the MAX function again to find the penultimate date from the same list but am unsure of the correct way to right it

    Would I write it in the Select statement as something like MAX(datetime)-1?

    Does anyone have any ideas?


  2. #2
    Join Date
    Nov 2010
    Insteresting question...
    First, do you know how to do it on any other database?
    And what happens if there are two equal dates? For example:

    2011-12-15 09:00:00
    2011-12-15 09:00:00
    2011-12-14 09:00:00

    Which one should be returned? Or is this scenario impossible? If in the example above the last row would be selected, than another subquery selecting the max(date_field) ... WHERE date_field < (select max(date_field) could be used (although I fear for the performance)


Posting Permissions

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