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 '2015-04-01' AND '2015-06-30' Order By calendar_date' at line 1