I am trying the following but get no results:
SELECT *
FROM users_test
WHERE dateadded >= UNIX_TIMESTAMP('2012-02-01 00:00:00')
AND dateadded < UNIX_TIMESTAMP('2012-11-01 00:00:00');
Yet I know there are columns with dates within that range e.g.
2012-05-11 17:10:08
Is there a better way to do this?
Eventually I want to search multiple parameters, albeit not at the same time, like today, yesterday, last week, last month etc and also a date range and month range
Have you tried?
For what I can see, it seems your table has the data stored in the same way you want to look for it (
2012-05-11 17:10:08), so in this case you won’t need UNIX_TIMESTAMP.Also I can see you want to exclude the 2nd date from results (because you’re using
<instead of<=), otherwise usingWHERE dateadded BETWEEN '2012-02-01 00:00:00' AND '2012-11-01 00:00:00'would be fine as well…