Menu Close

How to display all the column values in a single row separated by comma in MySQL?

5
(1)

We can get the column values in single row by , using GROUP_CONCAT() and CONCAT() methods. Check the below queries for reference.

Sample Code

select group_concat(concat('[',id,']')) AS ids  from table_name; 

How useful was this post?

Click on a star to rate it!

Average rating 5 / 5. Vote count: 1

No votes so far! Be the first to rate this post.

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?

Share

Posted in MySQL

Leave a Reply

Your email address will not be published. Required fields are marked *

You can also read...