I have a function that is placing timestamp values (YYYY-MM-DD HH:MM:SS) into META_VALUE
column of table META
.
What I want to do is to compare
SELECT * FROM table WHERE <timestamp-field> BETWEEN 'YYYY-MM-DD 00:00:00' AND 'YYYY-MM-DD 23:59:59'
Allways avoid doing calculations on the field if possible: e.g.
SELECT * FROM table WHERE DATE(<timestamp-field>) = 'YYYY-MM-DD'
will calculate DATE() for ALL rows in that table, so you are really talking wasted cycles here
Simply use DATE
:
SELECT * FROM table WHERE DATE(timestamp) = '2011-12-29'