SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    Resistance is Futile webgodjj's Avatar
    Join Date
    Nov 2002
    Location
    Madison, WI USA
    Posts
    448
    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,708
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    change DATE() to CURDATE()

  3. #3
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,338
    Mentioned
    63 Post(s)
    Tagged
    3 Thread(s)
    ... or better yet, CURRENT_DATE

    rudy.ca | @rudydotca
    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
  •