Results 1 to 2 of 2
  1. #1
    Join Date
    Nov 2014
    Posts
    1

    Unanswered: DB2 SQL to get most recent FULL six months + what ever days are in the current month

    In the where clause i am doing the following....

    MYDATE >= CURRENT DATE -6 MONTH

    This returns six months of data but its exactly 6 months. So its including part of Novemember and part of May 2014.

    My goal is to get the entire most recent six months and what ever partial days are in the current month.

    So May, June, July, August, September, October & whatever days are in Novemember so far. If I ran it today 11/12

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

    try this:

    MYDATE >= current date - (day(current date) - 1) days - 6 months
    Regards,
    Mark.

Posting Permissions

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