Exception: Query error 42000: SQLSTATE[42000]: Syntax error or access violation: 1066 Not unique table/alias: 'shop_item_discounts'. Query: SELECT
SQL_CALC_FOUND_ROWS
`shop_items`.*, 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`
INNER JOIN `shop_item_discounts` ON `shop_item_discounts`.`shop_item_id` = `shop_items`.`id`
INNER JOIN `shop_discounts` ON `shop_discounts`.`id` = `shop_item_discounts`.`shop_discount_id`
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` >= '2024-12-06 06:39:43' OR `shop_discounts`.`end_datetime` = '0000-00-00 00:00:00' AND `shop_discounts`.`start_datetime` <= '2024-12-06 06:39:43' )
WHERE `shop_items`.`shop_id` = '5' AND ( `shop_items`.`start_datetime` < '2024-12-06 06:39:43' OR `shop_items`.`start_datetime` = '0000-00-00 00:00:00' ) AND ( `shop_items`.`end_datetime` > '2024-12-06 06:39:43' OR `shop_items`.`end_datetime` = '0000-00-00 00:00:00' ) AND `shop_items`.`siteuser_group_id` IN (0, -1) AND `shop_discounts`.`active` = 1 AND `shop_discounts`.`start_datetime` < '2024-12-06 06:39:43' AND `shop_discounts`.`end_datetime` > '2024-12-06 06:39:43' AND `shop_discounts`.`deleted` = 0 AND `shop_items`.`modification_id` = 0 AND `shop_items`.`active` = 1 AND `shop_items`.`deleted` = 0 AND `shop_items`.`shortcut_id` = 0 AND `shop_items`.`active` = 1 AND `shop_items`.`deleted` = 0
GROUP BY `shop_items`.`id`
ORDER BY `absolute_price` DESC
LIMIT 9
OFFSET 0
36 modules/core/exception.php
612 modules/core/database/pdo.php
80 modules/core/querybuilder/statement.php
497 modules/core/orm.php
488 modules/core/entity.php
831 modules/shop/controller/show.php
526 hostcmsfiles/lib/lib_74/lib_74.php
271 modules/lib/model.php
166 modules/core/page.php
11 templates/template29/template.htm
96 modules/template/model.php
166 modules/core/page.php
248 templates/template28/template.htm
96 modules/template/model.php
166 modules/core/page.php
498 modules/core/command/controller/default.php
194 modules/core/router/route.php
239 index.php