UPDATE: WORKING SOLUTIONS
Getting an array type:
column1, CONCAT('[', GROUP_CONCAT(column2), ']') AS array FROM table GROUP BY column1
And this returns a column named array with following results: [x,y,z]
Getting an object type:
column1, CONCAT('[', GROUP_CONCAT(CONCAT('{ property_A:', column2, ', property_B:', column3, '}')), ']') AS object FROM table GROUP BY column1
And this returns a column named object with following results: [{property_A: x, property_B: z},{property_A: y, property_B: w}]
ORIGINAL QUESTION
I have SQL table like that:
N | B
1 | z
1 | w
1 | y
2 | x
2 | k
how has to be the query that returns something like that:
N | C => alias of collection of B
1 | [z, w, y]
2 | [x, k]
Thanks