SELECT id, upload_date, user_fullname, user_id, title, avg_rate, rate_count, img_subject, img_material, avatar_path, materials_ESP AS material, img_material as material_id, img_year, price, comment, section_ESP AS section, section_id, genres_ESP as genre, genres_id, style_ESP AS style, style_id, width, height, availability_ESP AS availability, availability_id, img_ratio, technique_id, technique_ESP AS technique, path_small, path_medium, img_true, view_in_virt_room, comment_ban, code, img_sensored, img_add_date, username, block, title_en FROM (SELECT images.id as id, upload_date, user_fullname AS user_fullname, user_id, title_ESP AS title, ROUND(AVG(rate),1) AS avg_rate, COUNT(rate) AS rate_count, img_subject_ESP as img_subject, img_material, img_year, img_price_value as price, img_comment_with_work_ESP as comment, section_id, genres_id, style_id, img_real_width AS width, img_real_height AS height, availability_id, img_ratio, technique_id, path_small, path_medium, img_true, comment_ban, code, img_sensored, username, block, title AS title_en FROM images, users, image_rating, system_countries WHERE images.id=9473 AND users.user_id=owner AND users.country_id = system_countries.id AND img_id=9473 LIMIT 1 )q LEFT JOIN users_avatars USING(user_id) LEFT JOIN image_materials ON materials_id=img_material LEFT JOIN image_sections USING(section_id) LEFT JOIN image_genres USING(genres_id) LEFT JOIN image_styles USING(style_id) LEFT JOIN image_availability USING(availability_id) LEFT JOIN image_technique USING(technique_id) LEFT JOIN image_additional_data ON id = img_id