Error: Column 'tenant_id' in where clause is ambiguous
Error No: 1052
SELECT DISTINCT *, `pd`.`name`, `p`.`image`, `p`.`price`, (SELECT `pd2`.`price` FROM `oc_product_discount` `pd2` WHERE `tenant_id`= '16893610022683029504' AND `pd2`.`product_id` = `p`.`product_id` AND `pd2`.`customer_group_id` = '1'AND `pd2`.`quantity` = '1' AND ((`pd2`.`date_start` = '0000-00-00' OR `pd2`.`date_start` < NOW()) AND (`pd2`.`date_end` = '0000-00-00' OR `pd2`.`date_end` > NOW())) ORDER BY `pd2`.`priority` ASC, `pd2`.`price` ASC LIMIT 1) AS `discount`, (SELECT CASE WHEN COUNT(*) > 0 THEN CASE WHEN MIN(s.type) = 'P' THEN p.price - (p.price * MIN(s.discount) / 100) -- Desconto percentual WHEN MIN(s.type) = 'F' THEN p.price - MIN(s.discount) -- Desconto fixo ELSE p.price -- Retorna o preço normal se não houver desconto END ELSE NULL -- Retorna NULL se não houver promoções END AS special_price FROM `oc_special` `s` LEFT JOIN `oc_special_to_product` `sp` ON `s`.`special_id` = `sp`.`special_id` LEFT JOIN `oc_special_to_category` `sc` ON `s`.`special_id` = `sc`.`special_id` LEFT JOIN `oc_special_to_manufacturer` `sm` ON `s`.`special_id` = `sm`.`special_id` WHERE `s`.`rule` = 'all' OR (`s`.`rule` = 'product' AND `sp`.`product_id` IN (SELECT `product_id` FROM `oc_special_to_product` WHERE `tenant_id`= '16893610022683029504' AND `product_id` = `p`.`product_id`)) OR `sc`.`category_id` IN (SELECT `category_id` FROM `oc_product_to_category` WHERE `tenant_id`= '16893610022683029504' AND `product_id` = `p`.`product_id`) OR `sm`.`manufacturer_id` IN (SELECT `manufacturer_id` FROM `oc_product` WHERE `tenant_id`= '16893610022683029504' AND `product_id` = `p`.`product_id`) AND `s`.`status` = '1' AND `s`.`date_start` <= NOW() AND `s`.`date_end` >= NOW() ) AS `special`, (SELECT `pr`.`points` FROM `oc_product_reward` `pr` WHERE `tenant_id`= '16893610022683029504' AND `pr`.`product_id` = `p`.`product_id` AND `pr`.`customer_group_id` = '1') AS `reward`, (SELECT COUNT(*) FROM `oc_review` `r` WHERE `tenant_id`= '16893610022683029504' AND `r`.`product_id` = `p`.`product_id` AND `r`.`status` = '1' GROUP BY `r`.`product_id`) AS `reviews` FROM `oc_product_special` `ps2` LEFT JOIN `oc_product_to_store` `p2s` ON (`ps2`.`product_id` = `p2s`.`product_id` AND `p2s`.`store_id` = '9223372036854775807' AND `ps2`.`customer_group_id` = '1' AND ((`ps2`.`date_start` = '0000-00-00' OR `ps2`.`date_start` < NOW()) AND (`ps2`.`date_end` = '0000-00-00' OR `ps2`.`date_end` > NOW()))) LEFT JOIN `oc_product` `p` ON (`p`.`product_id` = `p2s`.`product_id` AND `p`.`status` = '1' AND `p`.`date_available` <= NOW()) LEFT JOIN `oc_product_description` `pd` ON (`pd`.`product_id` = `p`.`product_id`) WHERE `tenant_id`= '16893610022683029504' AND `pd`.`language_id` = '2' GROUP BY `ps2`.`product_id` ORDER BY p.sort_order ASC, LCASE(`pd`.`name`) ASC LIMIT 0,10
: in /home/admin/domains/shopanel.com.br/public_html/system/library/db/mysqli.php on line 76