Offres manquées

SELECT `e`.*, `at_deal_start_date`.`value` AS `deal_start_date`, `at_deal_end_date`.`value` AS `deal_end_date` FROM `catalog_product_entity` AS `e` INNER JOIN `catalog_product_entity_datetime` AS `at_deal_start_date` ON (`at_deal_start_date`.`entity_id` = `e`.`entity_id`) AND (`at_deal_start_date`.`attribute_id` = '145') AND (`at_deal_start_date`.`store_id` = 0) INNER JOIN `catalog_product_entity_datetime` AS `at_deal_end_date` ON (`at_deal_end_date`.`entity_id` = `e`.`entity_id`) AND (`at_deal_end_date`.`attribute_id` = '146') AND (`at_deal_end_date`.`store_id` = 0) INNER JOIN `catalog_product_website` AS `product_website` ON product_website.product_id = e.entity_id AND product_website.website_id = 1 WHERE (at_deal_start_date.value < '2023-02-09 08:59:53') AND (at_deal_end_date.value < '2023-02-09 08:59:53') ORDER BY `at_deal_end_date`.`value` desc, `e`.`created_at` desc