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 reg_type = 2 and com_start_date <= '2013-05-19' and com_end_date >= '2013-05' at line 1