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 'WHERE mm_id='' AND bv_year='titan' AND sm_id=''' at line 1SELECT DISTINCT(eng_id) FROM WHERE mm_id='' AND bv_year='titan' AND sm_id=''