SELECT COUNT( cp.id_product ) AS total
FROM ps_product p
Left JOIN ps_product_shop product_shop ON ( product_shop.id_product = p.id_product
AND product_shop.id_shop =1 )
LEFT JOIN ps_category_product cp ON p.id_product = cp.id_product
WHERE cp.id_category in(6,126)
AND product_shop.visibility IN ('both', 'catalog')
AND product_shop.active =1
Friend Try this,
SELECT COUNT( cp.id_product ) AS total
FROM ps_product p
Left JOIN ps_product_shop product_shop ON ( product_shop.id_product = p.id_product
AND product_shop.id_shop =1 )
LEFT JOIN ps_category_product cp ON p.id_product = cp.id_product
and cp.id_category in(6)
LEFT JOIN ps_category_product cp1 ON p.id_product = cp1.id_product
and cp1.id_category in(126)
WHERE cp.id_category is not null
and cp1.id_category is not null
AND product_shop.visibility IN ('both', 'catalog')
AND product_shop.active =1