Results 1 to 7 of 7
  1. #1
    Join Date
    Jan 2009
    Posts
    124

    Unanswered: date range -60 to the future

    What I need to do is to select records withe the date column starting 60 days ago and into the future as far as there are record.

    This client Daniel Hinkley Web Site has speaking engagements which currently show all future engagements but we want to also show those for the last sisty days as he wants to show slide lists and notes to the events after the fact!

    Sort of like

    SELECT *
    FROM event_eve
    WHERE date_start BETWEEN (CURDATE() -60) AND (>CURDATE())

    Nick

  2. #2
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    Code:
    SELECT * 
       FROM event_eve
       WHERE (CURDATE() -60) < date_start
    -PatP

  3. #3
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    SELECT *
    FROM event_eve
    WHERE date_start >= CURRENT_DATE - INTERVAL 60 DAY



    pat, you ought to test and see what CURDATE() - 60 actually produces
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  4. #4
    Join Date
    Jan 2009
    Posts
    124

    dates

    You could at least make it look hard!

  5. #5
    Join Date
    Jan 2009
    Posts
    124
    Not so simple, I tried to get just the records from the last sixty days without success.

    SELECT *
    FROM event_eve
    WHERE datestart_eve = CURRENT_DATE - INTERVAL 60 DAY;

  6. #6
    Join Date
    Jan 2009
    Posts
    124
    Ah yes haz flavr!

    never mind.. between cur....

  7. #7
    Join Date
    Jan 2009
    Posts
    124
    Ah yes haz flavr!

    never mind.. between cur....

Posting Permissions

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