The following is the sample data of my table which I created it in Oracle 19c.
| id | first_numbers | second_numbers |
|---|---|---|
| 10 | 123 | 111 |
| 10 | 122 | 123 |
| 10 | 111 | 124 |
| 11 | 333 | 111 |
| 11 | 444 | 222 |
| 11 | 222 | 124 |
In above table some duplicate values are existed for each id, I want to remove the duplicate values for each id and I want the values of both columns to be shown in one column in the result query
The expected result which I want is:
| id | concatenated_colums |
|---|---|
| 10 | 123 |
| 10 | 111 |
| 10 | 122 |
| 10 | 124 |
| 11 | 333 |
| 11 | 111 |
| 11 | 222 |
| 11 | 124 |
>Solution :
Use a UNION statement:
SELECT id, first_numbers "concatenated_colums" FROM table
UNION
SELECT id, second_numbers "concatenated_colums" FROM table