Results 1 to 3 of 3
  1. #1
    Join Date
    Mar 2013
    Posts
    30

    Unanswered: Getting data from Monday - Friday, exclude weekends in db2

    Hello,

    I am using db2 my query (very simple) goes as follows:

    Select ShpDate, ShpAmt
    From Shipped

    Here is where I am having an issue. I need to get the previous business day data. For example If today is Tuesday then I need to get Monday data. The problem I encountered is what about Friday night. Our business days are from Monday - Friday. When Monday comes around I need Friday's date data. The date fields are defined as Decimal (8,0) in YYYYMMDD format. How can I code this from my SQL above. We are using the latest version of db2. Any help will be appreciated. Thank you in advance.

  2. #2
    Join Date
    Jul 2013
    Location
    Moscow, Russia
    Posts
    666
    Provided Answers: 55
    Hello,

    Is it so hard to calculate the correct date from a given date?
    To subtract 3 days if it's Monday, and 1 day otherwise?
    Regards,
    Mark.

  3. #3
    Join Date
    Apr 2008
    Location
    Iasi, Romania
    Posts
    559
    Provided Answers: 2
    Take a look here: http://www.ibm.com/developerworks/da.../0211yip3.html
    I am sure you will find what you need.
    Florin Aparaschivei
    DB2 9.7, 10.5 on Windows
    Iasi, Romania

Posting Permissions

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