You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'AND calendar_date BETWEEN '2014-12-01' AND '2015-02-28' Order By calendar_date' at line 1