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 ' 1, 0) as active FROM cities c JOIN cities_lang cl ON cl.city_id = c.city_id WHE' at line 1SQL: SELECT *, IF(c.city_id = , 1, 0) as active FROM cities c JOIN cities_lang cl ON cl.city_id = c.city_id WHERE cl.lang_id = 1 ORDER BY c.sort