MYSQL QUERY: SELECT o.id, o.sort_id, o.item_id, o.name, o.pic_name, o.html_name, o.car_begin, o.car_end, od.oil_short_description AS short_descr, od.oil_description AS description, od2.oil_description AS description_default, o.keyword, o.status, o.changed_at, o.published, osl1.subcategory_name AS 'category_name', s1.id AS 'cetegory_id', s1.category_alias AS 'category_alias', osl2.subcategory_name AS 'group_name', s2.id AS group_id, ( CASE WHEN cpa.page_alias !='' THEN cpa.page_alias ELSE cpa2.page_alias END ) AS 'group_alias', ossorl.oil_sort_name AS sort_name, o.shop_link, oil_shop_links.shop_link AS 'lang_shop_link' FROM oil o LEFT JOIN oil_subcategory_assoc_oil sao ON o.id = sao.oil_id LEFT JOIN oil_subcategory s ON sao.subcategory_id = s.id LEFT JOIN oil_subcategory_lang osl ON osl.oil_subcategory_id = s.id AND osl.id_lang LIKE 'ru' LEFT JOIN oil_subcategory s1 ON s1.id = s.parent_id LEFT JOIN oil_subcategory_lang osl1 ON osl1.oil_subcategory_id = s1.id AND osl1.id_lang LIKE 'ru' LEFT JOIN oil_subcategory s2 ON s2.id = s1.parent_id LEFT JOIN oil_subcategory_lang osl2 ON osl2.oil_subcategory_id = s2.id AND osl2.id_lang LIKE 'ru' LEFT JOIN oil_shop_links ON oil_shop_links.oil_id = o.id AND oil_shop_links.id_lang LIKE 'ru' LEFT JOIN cms_page_alias cpa ON cpa.get_param = s2.id AND cpa.id_lang LIKE 'ru' LEFT JOIN cms_page_alias cpa2 ON cpa2.get_param = s2.id AND cpa2.id_lang LIKE 'en' LEFT JOIN oil_description od ON o.id = od.oil_id AND od.language_id LIKE 'ru' LEFT JOIN oil_description od2 ON o.id = od2.oil_id AND od2.language_id LIKE 'en' LEFT JOIN oil_sort so ON o.sort_id = so.id LEFT JOIN oil_sort_lang ossorl ON ossorl.oil_sort_id = so.id AND ossorl.id_lang LIKE 'ru' WHERE o.id =

MYSQL ERROR: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '' at line 42