SELECT SQL_CALC_FOUND_ROWS wp_posts.*, (
SELECT SUM(rooms_available) rooms_available FROM (SELECT IFNULL(SUM(room_count), 0) rooms_available, availabilities.accommodation_id FROM wp_byt_accommodation_vacancies availabilities INNER JOIN (
select d.the_date from
(
select adddate('2026-10-23',t4.i*10000 + t3.i*1000 + t2.i*100 + t1.i*10 + t0.i) the_date from
(select 0 i union select 1 union select 2 union select 3 union select 4 union select 5 union select 6 union select 7 union select 8 union select 9) t0,
(select 0 i union select 1 union select 2 union select 3 union select 4 union select 5 union select 6 union select 7 union select 8 union select 9) t1,
(select 0 i union select 1 union select 2 union select 3 union select 4 union select 5 union select 6 union select 7 union select 8 union select 9) t2,
(select 0 i union select 1 union select 2 union select 3 union select 4 union select 5 union select 6 union select 7 union select 8 union select 9) t3,
(select 0 i union select 1 union select 2 union select 3 union select 4 union select 5 union select 6 union select 7 union select 8 union select 9) t4
having the_date between '2026-10-23' and '2028-10-23'
ORDER BY the_date
) d
where DATE(d.the_date) >= DATE(CURDATE())
group by d.the_date
order by d.the_date
) possible_dates ON (possible_dates.the_date >= DATE(availabilities.start_date) AND possible_dates.the_date < DATE(availabilities.end_date)) WHERE 1=1 AND ('2026-10-23' BETWEEN start_date AND end_date OR start_date <= '2028-10-23') AND end_date >= '2026-10-23' GROUP BY possible_dates.the_date, availabilities.accommodation_id ) as ra WHERE (accommodation_id = wpml_translations_default.element_id OR accommodation_id = wpml_translations.element_id) ) rooms_available , (
SELECT IFNULL(SUM(rooms_booked), 0) rooms_booked FROM ((SELECT IFNULL(SUM(bookings.room_count), 0) rooms_booked, bookings.accommodation_id, possible_dates.the_date FROM wp_byt_accommodation_bookings bookings INNER JOIN (
select d.the_date from
(
select adddate('2026-10-23',t4.i*10000 + t3.i*1000 + t2.i*100 + t1.i*10 + t0.i) the_date from
(select 0 i union select 1 union select 2 union select 3 union select 4 union select 5 union select 6 union select 7 union select 8 union select 9) t0,
(select 0 i union select 1 union select 2 union select 3 union select 4 union select 5 union select 6 union select 7 union select 8 union select 9) t1,
(select 0 i union select 1 union select 2 union select 3 union select 4 union select 5 union select 6 union select 7 union select 8 union select 9) t2,
(select 0 i union select 1 union select 2 union select 3 union select 4 union select 5 union select 6 union select 7 union select 8 union select 9) t3,
(select 0 i union select 1 union select 2 union select 3 union select 4 union select 5 union select 6 union select 7 union select 8 union select 9) t4
having the_date between '2026-10-23' and '2028-10-23'
ORDER BY the_date
) d
where DATE(d.the_date) >= DATE(CURDATE())
group by d.the_date
order by d.the_date
) possible_dates ON (possible_dates.the_date >= DATE(bookings.date_from) AND possible_dates.the_date < DATE(bookings.date_to)) AND IFNULL(woo_status, '') IN ('pending','completed','cancelled') WHERE 1=1 GROUP BY possible_dates.the_date, accommodation_id ) as rb, (SELECT MIN(start_date) min_start_date, MAX(end_date) max_end_date, accommodation_id FROM wp_byt_accommodation_vacancies GROUP BY accommodation_id) min_max_available_dates ) WHERE (rb.accommodation_id = wpml_translations_default.element_id AND min_max_available_dates.accommodation_id = wpml_translations_default.element_id) OR (rb.accommodation_id = wpml_translations.element_id AND min_max_available_dates.accommodation_id = wpml_translations.element_id) AND rb.the_date >= min_max_available_dates.min_start_date AND rb.the_date < min_max_available_dates.max_end_date ) rooms_booked , IFNULL((SELECT price_meta2.meta_value + 0 FROM wp_postmeta price_meta2 WHERE price_meta2.post_id=wpml_translations_default.element_id AND price_meta2.meta_key='_accommodation_min_price:2026-10-23:2028-10-23' LIMIT 1), 0) accommodation_price , IFNULL((SELECT price_meta3.meta_value + 0 FROM wp_postmeta price_meta3 WHERE price_meta3.post_id=wpml_translations_default.element_id AND price_meta3.meta_key='accommodation_static_from_price' LIMIT 1), 0) accommodation_static_price
FROM wp_posts INNER JOIN wp_postmeta ON ( wp_posts.ID = wp_postmeta.post_id ) JOIN wp_icl_translations wpml_translations
ON wp_posts.ID = wpml_translations.element_id
AND wpml_translations.element_type = CONCAT('post_', wp_posts.post_type) LEFT JOIN wp_icl_translations wpml_translations_default ON wpml_translations_default.trid = wpml_translations.trid AND (wpml_translations_default.source_language_code IS NULL OR wpml_translations.source_language_code IS NULL)
WHERE 1=1 AND (
wp_postmeta.meta_key = 'accommodation_star_count'
) AND wp_posts.post_type = 'accommodation' AND ((wp_posts.post_status = 'publish')) AND ( ( ( wpml_translations.language_code = 'nl' OR (
wpml_translations.language_code = 'en'
AND wp_posts.post_type IN ( 'post','page','e-floating-buttons','location','review','extra_item','room_type','accommodation','tour','cabin_type','cruise','car_rental','shop_order_refund','shop_order_placehold','templatera','wpcf7_contact_form','whatsapp-accounts' )
AND ( (
( SELECT COUNT(element_id)
FROM wp_icl_translations
WHERE trid = wpml_translations.trid
AND language_code = 'nl'
) = 0
) OR (
( SELECT COUNT(element_id)
FROM wp_icl_translations t2
JOIN wp_posts p ON p.id = t2.element_id
WHERE t2.trid = wpml_translations.trid
AND t2.language_code = 'nl'
AND (
p.post_status = 'publish' OR p.post_status = 'private' OR
( p.post_type='attachment' AND p.post_status = 'inherit' )
)
) = 0 ) )
) ) AND wp_posts.post_type IN ('post','page','attachment','wp_block','wp_template','wp_template_part','wp_navigation','e-floating-buttons','elementor_library','location','review','extra_item','room_type','accommodation','tour','cabin_type','cruise','car_rental','product','product_variation','shop_order_refund','shop_order_placehold','templatera','wpcf7_contact_form','whatsapp-accounts' ) ) OR wp_posts.post_type NOT IN ('post','page','attachment','wp_block','wp_template','wp_template_part','wp_navigation','e-floating-buttons','elementor_library','location','review','extra_item','room_type','accommodation','tour','cabin_type','cruise','car_rental','product','product_variation','shop_order_refund','shop_order_placehold','templatera','wpcf7_contact_form','whatsapp-accounts' ) )
GROUP BY wp_posts.ID HAVING 1=1 AND rooms_available > rooms_booked AND rooms_available >= 1
ORDER BY wp_postmeta.meta_value+0 DESC
LIMIT 0, 12
Om de beste ervaringen te bieden, gebruiken we technologieën zoals cookies om apparaatinformatie op te slaan en/of te openen. Door toestemming te geven voor deze technologieën kunnen we gegevens zoals surfgedrag of unieke ID's op deze site verwerken. Als je geen toestemming geeft of je toestemming intrekt, kan dit negatieve gevolgen hebben voor bepaalde functies.
Functioneel
Altijd actief
De technische opslag of toegang is strikt noodzakelijk voor het legitieme doel om het gebruik van een specifieke uitdrukkelijk door de abonnee of gebruiker gevraagde dienst mogelijk te maken, of met als enig doel de uitvoering van de verzending van een communicatie via een elektronisch communicatienetwerk.
Voorkeuren
De technische opslag of toegang is noodzakelijk voor het legitieme doel om voorkeuren op te slaan die niet zijn aangevraagd door de abonnee of gebruiker.
Statistieken
De technische opslag of toegang die uitsluitend wordt gebruikt voor statistische doeleinden.De technische opslag of toegang die uitsluitend wordt gebruikt voor anonieme statistische doeleinden. Zonder een dagvaarding, vrijwillige medewerking van je internetprovider of aanvullende gegevens van een derde partij kan informatie die alleen voor dit doel is opgeslagen of opgehaald, meestal niet worden gebruikt om je te identificeren.
Marketing
De technische opslag of toegang is nodig om gebruikersprofielen aan te maken voor het verzenden van reclame, of om de gebruiker te volgen op een website of op verschillende websites voor soortgelijke marketingdoeleinden.
Om de beste ervaringen te bieden, gebruiken we technologieën zoals cookies om apparaatinformatie op te slaan en/of te openen. Door toestemming te geven voor deze technologieën kunnen we gegevens zoals surfgedrag of unieke ID's op deze site verwerken. Als je geen toestemming geeft of je toestemming intrekt, kan dit negatieve gevolgen hebben voor bepaalde functies.
Functioneel
Altijd actief
De technische opslag of toegang is strikt noodzakelijk voor het legitieme doel om het gebruik van een specifieke uitdrukkelijk door de abonnee of gebruiker gevraagde dienst mogelijk te maken, of met als enig doel de uitvoering van de verzending van een communicatie via een elektronisch communicatienetwerk.
Voorkeuren
De technische opslag of toegang is noodzakelijk voor het legitieme doel om voorkeuren op te slaan die niet zijn aangevraagd door de abonnee of gebruiker.
Statistieken
De technische opslag of toegang die uitsluitend wordt gebruikt voor statistische doeleinden.De technische opslag of toegang die uitsluitend wordt gebruikt voor anonieme statistische doeleinden. Zonder een dagvaarding, vrijwillige medewerking van je internetprovider of aanvullende gegevens van een derde partij kan informatie die alleen voor dit doel is opgeslagen of opgehaald, meestal niet worden gebruikt om je te identificeren.
Marketing
De technische opslag of toegang is nodig om gebruikersprofielen aan te maken voor het verzenden van reclame, of om de gebruiker te volgen op een website of op verschillende websites voor soortgelijke marketingdoeleinden.