Radās neparedzēta kļūda! Ja kļūda turpina parādīties, lūdzam sazināties ar mums.

SELECT
              `cp`.`hotel_id` AS `id`,
              `h`.`aquapark`,
              `h`.`disco`,
              `h`.`sea`,
              `bh`.`rating`,
              `cp`.`charter_id`,
              `cp`.`departure_date`,
              `cp`.`source`,
              `cp`.`days`,
              `cp`.`pansion`,
              `cp`.`price`,
              `cp`.`old_price` FROM `charter_price` AS `cp`
            JOIN (SELECT 
            `cpx`.`hotel_id`,
            `cpx`.`charter_id`,
            `cpx`.`departure_date`,
            `cpx`.`days`,
            `cpx`.`date`,
            `cpx`.`pansion`,
            MIN(`cpx`.`price`) as price,
            `cpx`.`old_price` FROM `charter_price` AS `cpx`            
        
WHERE `cpx`.`departure_date` >= 1730584800 AND `cpx`.`departure_date` + ((`cpx`.`days`-1)*60*60*24) <= 1730325600
 GROUP BY `cpx`.`hotel_id` ORDER BY `price` ASC, `cpx`.`date` ASC) AS z ON z.hotel_id = cp.hotel_id 
                AND z.price = cp.price AND z.departure_date = cp.departure_date INNER JOIN `hotel` AS `h` ON `h`.`id` = `cp`.`hotel_id`
                INNER JOIN `charter` AS `c` ON `c`.`id` = `cp`.`charter_id`
                LEFT JOIN `bookingcom_hotels` AS `bh` ON `h`.`id` = `bh`.`hotel_id` 
                
WHERE 

            GROUP BY `cp`.`hotel_id`
            ORDER BY `cp`.`price` ASC, `cp`.`date` ASC, `h`.`name` ASC LIMIT 0,20