Equivalent of implode() purely in MySQL
Posted: Fri Jul 28, 2006 5:04 am
Hi,
I'm looking to pull data (just one column) from mysql which is over multiple rows.
e.g.
apple
banana
orange
pear
Now, I actually want the data in this format in just one row:
"apple,banana,orange,pear"
Does mysql offer some sort of "SELECT IMPLODE(',', my_column) AS foo" type of thing? I know I can do it with PHP but this a part of a much larger query so I'm trying to keep this all in a single query.
Cheers,
d11
I'm looking to pull data (just one column) from mysql which is over multiple rows.
e.g.
apple
banana
orange
pear
Now, I actually want the data in this format in just one row:
"apple,banana,orange,pear"
Does mysql offer some sort of "SELECT IMPLODE(',', my_column) AS foo" type of thing? I know I can do it with PHP but this a part of a much larger query so I'm trying to keep this all in a single query.
Cheers,
d11