I have a table containing countries:
id country
------------
0 Monaco
1 Mongolia
2 Montenegro
3 Morocco
4 Mozambique
5 Myanmar
I have a sub query that looks like this.
(SELECT country FROM COUNTRIES WHERE id < 10) AS ´Trip´
I want to have that subquery to be formatted as a string like this:
'Monaco, Mongolia, Montenegro, Morocco, Mozambique, Myanmar'
Is that possible?
You can use the group_concat function:
SELECT group_concat(country, ', ') FROM countries WHERE id < 10
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With