syntax error: SELECT p.title_one as title_one, p.alias as alias, p.description_one as description_one, p.photo as photo, p.id_city as id_city, p.id_districs as id_districs, p.title_city_one as title_city_one, p.title_districs_one as title_districs_one, p.id_price as id_price, p.no as no, p.id as id, pr.title_one as title_price_one, p.price FROM (SELECT p.title_one as title_one, p.alias as alias, p.description_one as description_one, p.photo as photo, p.id_city as id_city, p.id_districs as id_districs, p.title_city_one as title_city_one, c.title_one as title_districs_one, p.id_price as id_price, p.no as no, p.id as id, p.price FROM (SELECT p.title_one as title_one, p.alias as alias, p.description_one as description_one, p.photo as photo, p.id_city as id_city, p.id_districs as id_districs, l.title_one as title_city_one, p.id_price as id_price, p.no as no, p.id as id, p.price from table_product p LEFT JOIN table_product_list l ON p.id_city = l.id WHERE p.com='project' AND p.id_city = 40 AND p.active = 1 AND p.public = 1 order by p.no, p.id desc) p LEFT JOIN table_product c ON p.id_districs = c.id order by p.no, p.id desc) p LEFT JOIN table_product_list pr ON p.id_price = pr.id order by p.no, p.id desc