SELECT p.manufacturer_id AS value_id, 'm' AS option_id, COUNT(DISTINCT p.product_id) AS total FROM oc_product p LEFT JOIN oc_product_to_category p2c ON (p.product_id = p2c.product_id) WHERE p.status = '1' AND p2c.category_id = '177' GROUP BY p.manufacturer_id