I have 2 dates in database like this:
from_dateTime = 2013-06-12
to_dateTime = 2013-07-10
I want to search all records between from_dateTime
and to_dateTime
. I tried to use following code in mysql:
SELECT *
FROM users i
WHERE i.from_dateTime >= '2013-06-12' AND i.to_dateTime <= '2013-07-10'
But it doesn't work as I expected. Why am I getting empty result set?
UPDATE:
from_dateTime = 2013-06-11
to_dateTime = 2013-06-12
SQL:
SELECT * FROM users i WHERE NOW() between i.from_dateTime AND i.to_dateTime
NOW()
is 2013-06-12 08:17:13
and command cant find my record too.