Results 1 to 3 of 3
  1. #1
    Join Date
    Nov 2003
    Posts
    1

    Unanswered: selecting datasets which are updatet within the last x weeks! how?

    Hello,

    I've got a question.

    How is it possible to select datasets which are updateted within the last x weeks.

    it has to look something like this i think:

    select * from data WHERE date >= current_Timestamp - x weeks;

    , but i dont know how to fit in the weeks into that statement. my date is saved as a timestamp in my database ("20031119113909").

    i would be very happy if someone might help me.

    thanks a lot

    sorry for my english, its not the best i think

  2. #2
    Join Date
    Feb 2002
    Location
    Germany
    Posts
    141

    Re: selecting datasets which are updatet within the last x weeks! how?

    Scoobee,

    if you don't need the actual week, you can just use 7 days.
    For example, for 2 weeks you'll use:
    select * from data WHERE date >= current_Timestamp - (2 * 7) days;

    If you really need the correct week, I would write a UDF using a combination of DAYOFWEEK(), WEEK() and so on.

    HTH,
    Rodney Krick

  3. #3
    Join Date
    Sep 2003
    Location
    canada
    Posts
    230

    Re: selecting datasets which are updatet within the last x weeks! how?

    Originally posted by RKrick
    Scoobee,

    if you don't need the actual week, you can just use 7 days.
    For example, for 2 weeks you'll use:
    select * from data WHERE date >= current_Timestamp - (2 * 7) days;

    If you really need the correct week, I would write a UDF using a combination of DAYOFWEEK(), WEEK() and so on.

    HTH,
    Hi Rkrick,
    I am working with db2V7.2 fixpack 6 AIX 5.2

    could you please tell me (detail) how can create UDF? I know the coding of creating UDF but I have problem with how can compile it and how can create the modul in ..../sllib/function.
    Thank you in advance for your help.

Posting Permissions

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