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 udf_values.value = 'Video' AND issues.issue_startdate <= '2012-02-01' ORDER ' at line 5