We have a date example : 2016-05-10, i am trying to get a query from database using this date.
We have 2 tables : publish_at and end_at
SELECT * FROM `news` WHERE end_at <= '2016-05-11' AND publish_at >= '2016-05-10'
SELECT * FROM news WHERE '2016-05-11' BETWEEN publish_at AND end_at
The first query return correct data since the query reqest all events that publish in the 2016/05/10 or after and ended in the 2016/05/11 or before.
Change the query to
Select * from news where end_at between '2016-05-10' and '2016-05-11' or publish_at betweeb '2016-05-10' and '2016-05-12'