text
select main.*, category.name as category_name, category.title as category_title, category.id as category_id from (select a.*, c.* from menu a, menu_lang c where a.id=c.main_id and c.lang_id = '1') main left join (select * from category_element where identifier = 'menu') rel on main.id=rel.main_id left join (select a.*, c.* from category a, category_lang c where a.id=c.main_id and c.lang_id = '1') category on rel.category_id=category.id left join (select * from category where status=1) d on d.id=main.category where 1=1 and main.parent_id= and category.name='main_menu' and main.status = 1 order by main.order_no asc 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 category.name='main_menu' and main.status = 1 order by main.order_no asc' at line 1