Purpose:
get the table where the columns will be
1) condensed IDs separated by commas
2) The category to which they belong
3) category name
4) Number of IDs attached to each category
What I have done:
SELECT p.`product_id` as `id`, p.`category_id`, c.`name` FROM `oc_product_to_category` p LEFT JOIN `oc_category_description` c ON p.`category_id` = c.`category_id` WHERE p.`product_id` IN(727,1025,742) GROUP BY p.`category_id`, c.`name` Grouped by ID and category name.
What else needs to be done, collect all the IDs that fall into this category, concoin, and get the number of these IDs that are tied to this category.
Please tell me how to do this?
corrected. Added count (p. product_id ) now counts quantity. Cocotens stayed