Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

select

mysql

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:

enter image description here

How could I get the first and second rows on the 10th of April, or the 3rd row on the 25th (inclusive, like I said)?

Any help would be greatly appreciated. Thanks in advance!

like image 486
JJJollyjim Avatar asked Apr 18 '12 03:04

JJJollyjim


1 Answers

You can add a condition as follows

DATE(NOW()) between date1 and date2
like image 83
Chetter Hummin Avatar answered Oct 24 '22 09:10

Chetter Hummin