Let’s say I have the following table:
id | state | type | my_text
--------------------------------------
12345 | OH | 01 | blah
12345 | OH | 01 | testing
12345 | OH | 01 | hello world
12345 | OH | 02 | something else
12345 | OH | 02 | more text
Does there exist a MySQL grouping function that would allow me to output something like this?:
id | state | type | my_text
--------------------------------------
12345 | OH | 01 | blah|testing|hello world
12345 | OH | 02 | something else|more text
I am aware of similar functions for working with numbers (i.e. to calculate the average of a bunch of grouped rows), but I am looking for something that will group together text fields and delimit them. It seems fairly straight-forward, but I cannot seem to find the appropriate way to do this.
Thanks for any advice!
GROUP_CONCATcan do this, see http://dev.mysql.com/doc/refman/5.0/en/group-by-functions.html