Returning unique �cate_id's as a string separated by the comma(,) for each group of 'pub_id' from the book_mast table:

Publisher idGROUP_CONCAT(DISTINCT cate_id)
P001CA002,CA004
P002CA003
P003CA001,CA003
P004CA002,CA005
P005CA001,CA004
P006CA001,CA005
P007CA002,CA005
P008CA004,CA005