Reputation: 19827
So I have the following sql query
SELECT * FROM log WHERE Date > 2013-12-12 00:00:00 AND Date < 2014-02-08 00:00:00 LIMIT 10
Where the log table has a column Date
in the format Y-m-d H:i:s
One entry in the database has a Date
of 2014-02-06 21:48:10
which should be picked up by this query no? But it's not.
Is there anything I'm missing here?
Thanks
Upvotes: 1
Views: 2017
Reputation: 12042
you miss the quotes
Do like this for Date Range Selection
SELECT * FROM log WHERE `DATE` BETWEEN "2013-12-12" AND "2014-02-08" LIMIT 10;
Upvotes: 2
Reputation: 6344
You forgot the quotes
SELECT * FROM log WHERE `Date` > '2013-12-12 00:00:00' AND `Date` < '2014-02-08 00:00:00' LIMIT 10
Upvotes: 3