need output for this query in mysql -



need output for this query in mysql -

i have table book columns, here table structure

book_id book_name book_cat_id book_pub_id book_price 1 cat-1 p-1 100 2 b cat-2 p-2 150 3 c cat-3 p-3 452 4 d cat-4 p-4 452 5 e cat-1 p-3 620 6 f cat-2 p-4 300 7 g cat-3 p-1 750 8 h cat-4 p-2 125

i want output this

book_pub_id book_cat_id p-1 cat-1,cat-3 p-2 cat-2,cat-4 p-3 cat-3,cat-1 p-4 cat-4,cat-2

you can utilize group_concat():

select book_pub_id, group_concat(book_cat_id) book_cat_id tablename grouping book_pub_id;

mysql

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -