Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to display unique values among multiple columns

OraDev16Apr 9 2022

Hi All,
I've the following table with values and want to get the unique values among the three columns.
create table x (id number, c1 varchar2(20), c2 varchar2(20), c3 varchar2(20));
insert into x values (1, 'a','a,b,c', 'c,a,e,x');
insert into x values (2, 'b,x,y,c','a,b,c,x,z', 'y,m');
insert into x values (3, 'a,b,c','a,b,c', 'a,b,c');
select id, c1||','||c2||','||c3 "Non Unique Values" from x order by id;
Current Output :
image.png
Expected Output :
image.png
Thanks

This post has been answered by Solomon Yakobson on Apr 9 2022
Jump to Answer
Comments
Post Details
Added on Apr 9 2022
9 comments
1,115 views