Results 1 to 3 of 3
  1. #1
    Join Date
    Jan 2012

    Unanswered: select a rolling 12 full months

    Can anyone help me with a query that selects a rolling twelve full months of data based on the date the query is run? For example - if I ran the query today I would just pull data for calendar year 2011, but if I ran it february 17th, then it would pull Feb 2011 thru Jan 2012?

  2. #2
    Join Date
    Aug 2003
    Where the Surf Meets the Turf @Del Mar, CA
    Provided Answers: 1
    OraFAQ Forum: General Puzzle n00 - Row generator *

    Hopefully, you can modify code in URL above to meet your specific requirements
    You can lead some folks to knowledge, but you can not make them think.
    The average person thinks he's above average!
    For most folks, they don't know, what they don't know.
    Good judgement comes from experience. Experience comes from bad judgement.

  3. #3
    Join Date
    Jun 2004
    Liverpool, NY USA
    select column1
    from my_table
    where date_column between add_months(trunc(sysdate,'MONTH'),-12) AND trunc(sysdate,'MONTH');
    You do not need a parachute to skydive. You only need a parachute to skydive twice.

Posting Permissions

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