GROUP_CONCAT with JOIN in MySQL

By | September 10, 2016

GROUP_CONCAT with JOIN in MySQL

The GROUP_CONCAT function concatenates strings from a group into one string with various options.

Usage of GROUP_CONCAT with JOIN

Product Table

product_id name
1 abc
2 adc

product_to_category table:

product_id category_id
1 1
2 1
2 2
2 3
1 3

category_description table:

category_id name
1 A
2 B
3 Other

Output:

product_id name categoryname
1 abc A, Other
2 adc A, B, Other
🔥0

Leave a Reply