MySQL Arrays: Can It Be Done?

Is it possible to select the concatenation of all the results returned by the subquery?

So, if a subquery returns more than one row, can I somehow get all the results contained in one row?

+1
arrays mysql subquery concatenation
Jan 26 '12 at 19:44
source share
2 answers

Grade. You can get the concatenated result of all the rows that were grouped together with GROUP_CONCAT . You can use this to use GROUP BY on a column that, as you know, correctly grouped the result set, and then use the function to return the held groups. A few examples should be given on the manual page.

+2
Jan 26 '12 at 19:53
source share

Some MySQL clients, such as the MySQL command-line tool, can export the result set in various formats, such as XML.

If you use a programming language that implements the MySQL client / server protocol through some type of API, it looks like creating an array will be trivial in code. The PHP MySQL API returns the results to an array.

If you're talking about grouping multiple rows in a result set into one row, see GROUP_CONCAT .

+1
Jan 26 '12 at 20:30
source share



All Articles