I have a table with a one to many mapping from ID to some_value. What query can give me all of some_value for a particular ID?
I can use any array, string, or other object useful in SQL as the final result in list_of_values. You don’t need to use my comma seperated format.
My particular varient of SQL is Hive, but the syntax and functions are very similar to MySQL 🙂
Starting table:
ID some_value
----------- ------------
1 a
1 b
1 c
2 x
2 y
2 z
2 a
3 g
3 h
Finished table:
ID list_of_values
---------- ----------------
1 a, b, c
2 x, y, z, a
3 g, h
1 Answer