SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Thread: check for between dates

  1. #1
    Resistance is Futile webgodjj's Avatar
    Join Date
    Nov 2002
    Location
    Madison, WI USA
    Posts
    447
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    check for between dates

    I have two columns, Start_Date and End_Date in a table. I need to do a query to see if today is between them....

    Is this the way to go about it?

    select * from coupon where DATE() >= Start_DATE and DATE() <= End_Date;
    Atomic Coffee Media
    http://www.atomiccoffee.com
    JJ Pagac

  2. #2
    SitePoint Wizard guelphdad's Avatar
    Join Date
    Oct 2003
    Location
    St. Catharines, ON Canada
    Posts
    1,704
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    change DATE() to CURDATE()

  3. #3
    SQL Consultant silver trophybronze trophy
    SitePoint Award Recipient r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    38,470
    Mentioned
    35 Post(s)
    Tagged
    1 Thread(s)
    ... or better yet, CURRENT_DATE

    r937.com | rudy.ca | Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

Bookmarks

Posting Permissions

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