Say for example I have the following in a table:
grouping | user_id |
---|---|
A | abcdefg |
B | 123456 |
A | hijklmn |
A | opqrstu |
B | 789012 |
C | ... |
The result I would like to SELECT in a single query is:
grouping | user_id |
---|---|
A | abcdefg, hijklmn, opqrstu |
B | 123456, 789012 |
C | ... |
... and so on as far as there is a unique 'grouping' and the user_ids found under those groupings.
Is it possible to do this in a single query?
I have done some research of my own and seen syntax such as XML, CONCAT and others but as far as I can tell those answers do not account for multiple lists and multiple groupings.