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 ') as cnt FROM tb_restaurant as r INNER JOIN mast_city c ON r.res_city = c.city_' at line 1