Is it possible to group_concat
records by distinct Ids:
GROUP_CONCAT(Column2 BY DISTINCT Column1)
I need to get the values from column2
by distinct values from column1
. Because there are repeating values in column 2, that's why I can't use distinct on column2
.
Any thoughts on this? Thanks!
EDIT 1
Sample Table Records:
ID Value
1 A
1 A
2 B
3 B
4 C
4 C
Using the GROUP_CONCAT
the I wanted [GROUP_CONCAT(Value BY DISTINCT Id)
], I will have an output:
A, B, B, C
EDIT 2
Somehow got my group_concat
working:
GROUP_CONCAT(DISTINCT CONCAT(Id, '|', Value))
This will display the concatenated values by distinct id, just need to get rid of the Id somewhere. You can do it without the concat
function, but I need the separator. This may not be a good answer but I'll post it anyway.