How to check if a date is between date1 and date2 using mysql?

前端 未结 6 2120
醉梦人生
醉梦人生 2021-01-03 03:49

I\'m trying to write a query that will check today\'s date against my table columns date1 and date2 in mysql/php.. This is what I\'m after:

\'events\' table:

6条回答
  •  滥情空心
    2021-01-03 04:31

    If your referring to compare the date today is between a start and end date, I think you should use this:

    SELECT *
    FROM table
    WHERE '2014-08-20' >= start_date
    AND '2014-08-20' <= end_date
    

    Hope this helps :)

提交回复
热议问题