Results 1 to 6 of 6
  1. #1
    Join Date
    Feb 2012
    Posts
    6

    Unanswered: Calculate current date minus 14

    Hi,

    i want to query some tables and filter in a where for a specific day.

    INSERT INTO Table_Temp(uebnahmdatum, erfnr, schltermart, termdatum, abtlg,
    lfdabfnr)
    select uebnahmdatum, archiv.erfnr, schltermart, termdatum, archiv.abtlg,
    archiv.lfdabfnr
    from archiv,esview
    where archiv.lfdspaufnr = esview.auftr_nr
    and esview.lst_datum > "06.02.2012" <- here i want to change day automatically to current day minus 14 days.

    and esview.haus = " 1"
    and esview.abtlg = " 2";


    mister google isn't very helpful to this problem.

    the best solution i could think of to get the value i want, is getting it from another table, in which i write this "day minus 14" value with the help of a little program(written in c# or something).

    to avoid this, i posted here to get some help.


    for the reason i'm german, my english sucks. so please do not mind my syntax! :-P


    greetings taccu.

  2. #2
    Join Date
    Feb 2012
    Posts
    6

    additional information

    *
    the version is 7.3(informix server).

    all i got is a 20 year old book.

    it's a great help sometimes, but not all the time.

  3. #3
    Join Date
    Dec 2003
    Location
    North America
    Posts
    146
    I think you're looking for something like this:

    and esview.lst_datum > (today - 14)

  4. #4
    Join Date
    Feb 2012
    Posts
    6
    exactly, result should be in format dd.mm.yyyy.

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

    the default display format is handled by the DBDATE environment variable
    in your case, this should be
    DBDATE=dmy4.

    playing around with the date-related SQL built-in functions with help you to achieve the desired format.

    What is your IDS version number?

  6. #6
    Join Date
    Feb 2012
    Posts
    6
    to solve my own problem

    all you need to do is

    Today(whis is a system given variable) -14

    "Today -14"

    output is normally dd.mm.yyyy.

Posting Permissions

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