Hello there,
I'm selecting only one column, so if I have 20 rows in result, how to merge all these rows into one row where all the rows will be comma separated?

Thnx in advance

Recommended Answers

All 5 Replies

fetch in a loop and keep concatenating till no more record is there.

You mean loop in MySQL? or using PHP or something else? Is there any method in mysql to do it with one function?

You need to write a function using MYSQL for the purpose..

You can follow this sample if you want to.

Use the builtin mysql function group_concat().

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.