i'm having some troubles getting results by searching on date.
here's the format:
if i'm searching i tried to use this:
select * from aol where QueryTime BETWEEN '2006-03-19 00:00:00' and '2006-03-18 00:00:00'
But i'm never getting any results :(
Between requires lower value before and after greatest value of the range, otherwise it returns an empty resultset without any error.
select * from aol where QueryTime BETWEEN '2006-03-18 00:00:00' and '2006-03-19 00:00:00'
is the same of writing
select * from aol where QueryTime >= '2006-03-18 00:00:00' and QueryTime <= '2006-03-19 00:00:00'
You could look at the difference between the two dates:
SELECT DATEDIFF('2007-12-31 23:59:59','2007-12-30');
Or this may work as well.
SELECT something FROM tbl_name -> WHERE DATE_SUB(CURDATE(),INTERVAL 30 DAY) <= date_col;
Both of these examples came from this page. They show a lot of different ways that you could do this.