Two problems:
One: It's a bad idea to name a column "timestamp" because that's a reserved word. If you have to use it,
quote your identifier.
Two: MySQL is reading 2009-11-15 as 2009 minus 11 minus 15, or 1983. So your query is really saying:
Code:
SELECT * FROM patients
WHERE timestamp between 1983 AND 1981
MySQL won't warn you when you make a mistake like this.
The correct syntax for a date literal, assuming you're using 5.5.
Your code will probably want, depending on what date type you're actually using:
Code:
SELECT *
FROM patients
WHERE `TIMESTAMP` BETWEEN date '2009-11-15' AND date '2009-12-16'