SELECT MySQL rows where today's date is between two DATE columns

前端 未结 4 1183
粉色の甜心
粉色の甜心 2021-02-05 20:27

How can I get the rows in a table where today\'s date is between (inclusive) two DATE columns of that row? For example, take these two columns of a table:

4条回答
  •  青春惊慌失措
    2021-02-05 20:55

    Just use the SQL now() function to compare the date columns like so:

    SELECT * from table where now() >= from_date and now() <= to_date
    

提交回复
热议问题