I am trying to find the MySQL equivalent of the PostgreSQL array and array_to_string functions and stumbled upon this post but ask about oracle9i, which does not help me. I need to achieve this using MySQL, but even Google cannot find suitable answers.
So you do not need to read two entries, here is a repeat of the question:
In PostgreSQL, using the array and array_to_string functions, you can do the following:
Given the people table:
id | name --------- 1 | bob 2 | alice 3 | jon
SQL:
SELECT array_to_string(array(SELECT name FROM people), ',') AS names;
Will return:
names ------------- bob,alice,jon
Anyone have any ideas how to achieve this in MySQL?
source share