SQL between dates including start and end dates

后端 未结 6 851
野性不改
野性不改 2021-01-04 08:34

So I have this:

 (CURDATE() BETWEEN start_date AND end_date) 

Works fine.

But when the CURDATE() is 2011-12-02 and th

6条回答
  •  甜味超标
    2021-01-04 09:11

    It will work ... BETWEEN works inclusive of the boundary values. That is,

    (CURDATE() BETWEEN start_date AND end_date)
    

    including start_date,end_date and any day falling between

    CURDATE() BETWEEN start_date AND ADDDATE(CURDATE(), INTERVAL 1 DAY);
    

提交回复
热议问题