This question already has an answer here:

I'm working on a project to find the association rule of items for Market dataset. I have a huge database that contains multi-tables. The output I got from this query

select sales_fact_1997.customer_id, sales_fact_1997.product_id,     
from sales_fact_1997 , product
where sales_fact_1997.product_id = product.product_id
group by sales_fact_1997.customer_id , sales_fact_1997.product_id
order by sales_fact_1997.customer_id, product.product_name;

is like that:

customer_id     product_id      product_name
13               1466           Hot Dogs
13               937            American Cole Slaw 
13               10             Akron City Map

Is there a way to get the output in this format:

customer_id     product_id      product_name
13              1466,937,10     Hot Dogs, American Cole Slaw, Akron City Map

marked as duplicate by mustaccio, Michael Green, Tom V, Paul White Apr 2 '16 at 7:57

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

SELECT customer_id,
       GROUP_CONCAT(product_id) AS product_ids,
    FROM tbl
    GROUP BY customer_id;

Not the answer you're looking for? Browse other questions tagged or ask your own question.