Results 1 to 2 of 2
  1. #1
    Join Date
    Oct 2012
    Posts
    1

    Unanswered: informix compare interval and a integer

    I got two date columns start date and end date, and a third column which is days between end date and start date. now i need to find all rows i.e count of rows where the third column is less than 30days. the third column is coming out as a interval and we are comparing it with an integer which is where the error is. Is there a work around this. thanks

  2. #2
    Join Date
    Sep 2011
    Location
    Pont l'Abbé, Brittany, France
    Posts
    381
    Provided Answers: 1
    Hi,

    are your '2' columns of type DATE or DATETIME ?

    If DATE, you do not need an INTERVAL type for the interval between both, and in addition I'm not sure this works.

    All you need to do is
    SELECT ...
    From yourtable
    where date2-date1 < 30

    For me no need to keep a special column for the interval, because if you change one date, the interval value will have to be changed.
    Also this won't probably accelerate response times...

    E.

Posting Permissions

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