Расчет цены с доставкой
SELECT MIN(t.absolute_price) AS `min`, MAX(t.absolute_price) AS `max` FROM (SELECT IF (`shop_items`.`shop_currency_id` = '3', IF (shop_discounts.value, IF(shop_discounts.type, price * 53 - shop_discounts.value, price * (100 - shop_discounts.value) * 53 / 100), shop_items.price * 53), IF (`shop_items`.`shop_currency_id` = '2', IF (shop_discounts.value, IF(shop_discounts.type, price * 60 - shop_discounts.value, price * (100 - shop_discounts.value) * 60 / 100), shop_items.price * 60), IF (`shop_items`.`shop_currency_id` = '1', IF (shop_discounts.value, IF(shop_discounts.type, price * 1 - shop_discounts.value, price * (100 - shop_discounts.value) * 1 / 100), shop_items.price * 1), price))) AS `absolute_price` FROM `shop_items` LEFT OUTER JOIN `shop_item_discounts` ON `shop_items`.`id` = `shop_item_discounts`.`shop_item_id` LEFT OUTER JOIN `shop_discounts` ON `shop_item_discounts`.`shop_discount_id` = `shop_discounts`.`id` AND ( `shop_discounts`.`end_datetime` >= '2019-05-25 11:04:22' OR `shop_discounts`.`end_datetime` = '0000-00-00 00:00:00' AND `shop_discounts`.`start_datetime` <= '2019-05-25 11:04:22' ) WHERE `price` > 0 GROUP BY `shop_items`.`id`) AS `t`

Бордовый камень

Выбор параметров
Интересные статьи