I have a Table A that has 4 columns: a, b, c, d. I am grouping columns a, b, and c, and want to display a concatenated value with ',' of d column in 4th column. How do I achieve that?
Asked
Active
Viewed 38 times
0
-
So do you mean all possible values of the fourth column shown in a comma delimited list? Does order, or the number of times each value appears matter? Should it be a distinct list, or include duplicates? What are you aggregating or summarizing to group by in the first place? Is that column included in result set? – RThomas Dec 06 '19 at 05:56
-
I'm thinking this is not a job for group by. It almost sounds like you just want a distinct listing of possible combinations of 1st, 2nd, and 3rd columns - combined with a comma delimited list of all the possible values of the fourth. That would take the shape of two logical selects joined. – RThomas Dec 06 '19 at 05:59
-
You are right RThomas. Grouping is just for understanding. Duplicates will be fine and order is also not required. – Abhi619 Dec 06 '19 at 06:00
-
It's a duplicate of a duplicate.... – Zohar Peled Dec 06 '19 at 06:03