Reputation:
I have a table like this and I want to select distinct value in single column:
ID Value
1 13245|43558
2 45961|5051
3 43558| 5059
I need output Like this:
13245,43558,45961,5051,5059
Upvotes: 0
Views: 3698
Reputation: 37233
try that:
select group_concat(distinct trim(substring_index(substring_index(value, '|', n.n), '|', -1)) separator ',' ) as `values`
from table1 t
cross join (select 1 as n union all select 2 ) n
order by `values`
Upvotes: 2