Knowing that I have a table called eventos
, and this table has the columns id
, titulo
, inicio
and fim
. The inicio
and fim
columns are of type timestamp , where the start and end date and time of a certain event is written. When I make a% of of this table, how do I get the events of a specific date that is between the date of the start column and the end column?
Example: Assuming I have a record in this table with the start column having the value select
and the end column with the value 2014-02-01 13:00:00
. It is an interval of 4 days, and their respective hours. How could I get this record on a specific day using the following SQL below?
SELECT titulo
FROM eventos
WHERE inicio <= '2014-02-03'
AND fim >= '2014-02-03'
One of the problems is that if my registry is with the start column with value 2014-02-05 22:30:00
and I query for 2014-02-01 13:00:00
, that is, the same start date, it is not found. Knowing that I have the WHERE inicio <= '2014-02-01'
operator.