Results 1 to 3 of 3
  1. #1
    Join Date
    Sep 2009
    Posts
    4

    Unanswered: Same day last year

    Can someone pls help me with the DB2 code how to acheive the following result:

    THIS_YEAR LAST_YEAR
    --------------------- ---------------------
    Wed 10 June 2009 Wed 11 June 2008


    I am looking at Same DAY of the last year not the date.

    Thanks,
    Guru.

  2. #2
    Join Date
    Jan 2003
    Posts
    4,292
    Provided Answers: 5
    Try:

    values current date - 1 year + dayofweek(current date) days - dayofweek(current date - 1 year) days

    Andy

  3. #3
    Join Date
    Sep 2009
    Posts
    4

    Same Day last year

    select dy.DAY_DT TY_DT,
    dayname(dy.DAY_DT) as TY_DAY
    from PROD_DY dy

    Here is the code as of now. Can you please add a column to this statement which will contain the previous year same day. I really appreciate all 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
  •