これほど大きなクエリと多くの結合を行うのは初めてです。このクエリを実行すると、非常に遅くなります。外部キーの使用方法と、それが役立つかどうかはわかりません...しかし、これを高速化できる方法を誰かが知っていれば、非常に役立ちます。これが私のクエリです:
SELECT FLOOR(AVG(ra.double)) AS price, hi.hname, hi.hotel_id as hid, hi.hstars, hi.haddress, im.image_file, hd.short_desc, pr.promo_name, pr.discount, pr.discount_type, pr.book_start, pr.book_end
FROM hotel_info AS hi
JOIN images AS im ON im.foreign_id = hi.hotel_id
LEFT JOIN hotel_desc AS hd ON hd.hotel_id = hi.hotel_id
RIGHT JOIN rates AS ra ON ra.hotel_id = hi.hotel_id
RIGHT JOIN promotions AS pr ON pr.hotel_id = ra.hotel_id
WHERE ra.booking_date BETWEEN '2012-01-01' AND '2012-01-06'
AND ra.double != '0.00'
AND hi.status = '1'
AND hi.destination_id = '$destination'
GROUP BY hi.hotel_id