Results 1 to 3 of 3
  1. #1
    Join Date
    Dec 2010
    Posts
    136

    Unanswered: select the first three consecutive months

    Hi..

    I need help in selecting first 3 Consecutive Months from my table ETD which type is Date.

    for example in my ETD:

    2012-04-01
    2012-04-01
    2012-04-05
    2012-04-08
    2012-04-08
    2012-05-01
    2012-05-01
    2012-05-05
    2012-05-08
    2012-05-08
    2012-06-01
    2012-06-01
    2012-06-05
    2012-06-08
    2012-06-08
    2012-07-01
    2012-07-01
    2012-07-05
    2012-07-08
    2012-07-08
    2012-08-01
    2012-08-01
    2012-08-05
    2012-08-08
    2012-08-08


    Now from this ETD data:

    I need to select only are:
    (from April - June)
    2012-04-01
    2012-04-01
    2012-04-05
    2012-04-08
    2012-04-08
    2012-05-01
    2012-05-01
    2012-05-05
    2012-05-08
    2012-05-08
    2012-06-01
    2012-06-01
    2012-06-05
    2012-06-08
    2012-06-08

    Thank you

  2. #2
    Join Date
    Sep 2009
    Location
    San Sebastian, Spain
    Posts
    880
    Selecting the first three consecutive months is Jan to Mar. So do you mean the 3 consecutive month from the first date in the list?
    Ronan Cashell
    Certified Oracle DBA/Certified MySQL Expert (DBA & Cluster DBA)
    http://www.it-iss.com
    Follow me on Twitter

  3. #3
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    Last edited by r937; 04-28-12 at 08:10.
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

Posting Permissions

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