Fatal error: Uncaught Exception: Error: Not unique table/alias: 'pd'<br />Error No: 1066<br />
SELECT
p.product_id,
COALESCE(r.rating, 0) as rating,
COALESCE(pd2.price, p.price) as discount_price,
COALESCE(ps2.price, p.price) as special_price,
p.viewed as `p.viewed`,
if(p.quantity, 1, 0) in_stock
FROM `oc_product` p
LEFT JOIN `oc_product_description` pd ON (pd.product_id = p.product_id)
LEFT JOIN (
SELECT r2.product_id, AVG(r2.rating) as rating
FROM `oc_review` r2
WHERE r2.status = '1'
GROUP BY r2.product_id
) r ON r.product_id = p.product_id
LEFT JOIN (
SELECT pd3.product_id, MIN(pd3.price) as price
FROM `oc_product_discount` pd3
WHERE pd3.customer_group_id = '1'
AND pd3.quantity = '1'
AND ((pd3.date_start = '0000-00-00' OR pd3.date_start < NOW())
AND (pd3.date_end = '0000-00-00' OR pd3.date_end > NOW()))
GROUP BY pd3.product_id
) pd2 ON pd2.product_id = p.product_id
LEFT JOIN (
SELECT ps3.product_id, MIN(ps3.price) as pri in /www/wwwroot/wholesalejerseyzone.com/system/library/db/mysqli.php on line 41